FUNCTIONAL PROGRAMMING IN SCALA – GTSC05
Scala is a hybrid programming language, providing support for the Object Oriented, Functional and Generic programming paradigms. After a brief review/overview of the language basics and philosophy, this course explores Scala’s support for Functional and Generic programming in more detail.
The course will demonstrate how techniques from functional programming, the terminology of which often appear somewhat abstract and remote, can in fact be used to produce highly concise and expressive code in Scala, and how we can reason about this code in a way that is not possible in imperative languages such as Java or C++.
The course will also discuss the importance of types in Scala programs, how these again can be used to reason about a program so that we may have more confidence about its correctness. We will also discover how, since Scala’s type system is Turing complete, computation may be performed on types as well as on values – leading to the potential for highly generic programming.
Examples using libraries from the Typelevel Scala libraries such as Shapeless and Cats will be used to illustrate the concepts.
Practical exercises are also used to emphasise the concepts covered in the course.
Web Developers, preferably with Scala experience.
This is not an introductory course, some experience with Scala will be highly beneficial. Alternatively experience with the latest versions of Java or C++ may also be helpful.
Summary Course Content
Implicits and Typeclasses
Achieving ad-hoc polymorphism
Algebraic Data Types:
Data modelling; Structural recursion (Processing ADTs); Parameterised ADTs
Functional Programming Patterns:
What they are and why they are useful (Functor, Monoid, Applicative, Monad); Examples of usage (Exceptions, I/O); Scala libraries for functional programming (cats)
More about types:
The importance of types in Scala; Abstract types
Type level programming
Types vs values; Programming in the compiler (Scala’s approach); Introducing the Shapeless library (The HList (Heterogeneous List) type); Examples of use from (e.g.) database libraries (Slick)