This module introduces the functional programming support provided out-of-the-box by Scala. In particular, it reviews the important concepts of compositionality and currying, and it shows how functional abstractions are mapped into object-oriented constructs.
Module 2: Functions and Algebraic data types (4 hours)
This module focuses on the most basic way to represent data types in functional programming: algebraic data types. Equally important, it also introduces type-driven development, the methodology par excellence to write functional programs, and illustrates its application through a number of exercises dealing with isomorphisms and logical proofs.
Functional programming excels at modularity and reuse, and this is exemplified by the de-facto standard catalog of higher-order functions introduced in this module. Examples taken from Spark will be used when possible in this module and the previous one.
The previous module exemplifies the use of HOFs for manipulating in-memory data structures such as lists. But, equally important, HOFs are also relevant for implementing imperative and applicative computations dealing with Futures, Error-handling, State, and so forth.