Wrap Up
Summarize the key takeaway points of this course.
We'll cover the following
Key takeaways from the course
We covered quite a lot of content in this course, and have seen firsthand how functional programming excels at abstraction and composition. Let’s first review abstraction. We’ve seen that functions are the primary means to form computations that work on any argument. A square
function represents a method to compute the square of any number, not just the square of a particular one. Of course, there is nothing new about this because almost all programming languages, functional and imperative alike, rely on functions for this kind of abstraction. What’s new is how functional programming treats functions as first-class citizens. This opens the door to defining higher-order functions that take other functions as input or return functions as output. Higher-order functions make it possible to define highly general computation methods, such as accumulate
, map
, filter
, and fold
. Abstraction is a crucial technique to programming, and functional programming is exceedingly good at it.
Composition, another essential technique, allows us to develop large software programs by composing smaller ones. Functional programming excels at composition due to several reasons. First, we saw that everything is an expression in the functional paradigm. For example, the if
conditionals and functions are all expressions. Because of this, we can combine smaller expressions to form complex ones. Second, functions are pure in the functional paradigm—they always return the same output for the same input. Another defining feature of functional programming is that functions are defined on immutable data. This means a function does not modify the data state, but instead constructs new data for the input data. This implies that functions in functional programming are close to mathematical functions. This property allows us to compose functions to create new ones with ease. Furthermore, functions can be connected in the dataflow style by agreeing on a shared data structure for input or output. For instance, we can compose map
, filter
, and fold
to construct dataflow programs because these functions rely on lists as a shared interface.
We hope the course has shown you how powerful and elegant functional programming is. We would even claim that functional programming is quite simple once we grasp its way of thinking. Many big ideas in the functional programming paradigm—such as first-class functions, higher-order functions, pure functions, immutable data, currying, and partial application—might look scary at first, but are inherently simple.
Get hands-on with 1200+ tech skills courses.