I recently finished a Coursera class entitled ‘Functional Programming Principles in Scala’, taught by none other than Martin Odersky himself. For those that don’t know, Martin is the creator of the Scala language and a professor at École Polytechnique Fédérale de Lausanne.
Read it and weep: scala_certificate
For those contemplating taking this class, I encourage you to do so. It was well worth it! My only “caution” would be to take note of the title — the class is truly about FUNCTIONAL PROGRAMMING using Scala. Meaning, you will focus on solving problems in a purely functional way (in the mathematical sense). E.g. no mutable variables, functions as first class citizens, currying, etc.
I think the code snippet below is one of the more beautiful pieces of code I’ve ever seen, and it’s representative of the types of things you’ll learn. It defines the (infinite) series of prime numbers in a ‘lazy’ way.
def from(n: Int): Stream[Int] = n #:: from(n+1)
def sieve(s: Stream[Int]): Stream[Int] = s.head #:: sieve(s.tail filter (_ % s.head != 0))
val primes = sieves(from(2))
The entire class is 7 weeks. Each week you’ll watch approximately 90 minutes of video lectures, and you’ll have some assignments that get progressively more difficult as the course progresses. At first the assignments are very easy, but by week 6 they get fairly difficult. Expect to average around 5-7 hours per week on assignments. You’ll upload the assignments using a provided tool, and within a few minutes you’ll get your grade. You can submit the assignments as many times as you like to improve your grade, up to the point the assignment is due.
Here is the week by week breakdown of topics:
- Functions and Evaluations
- Higher Order Functions
- Data and Abstraction
- Types and Pattern Matching
- Lazy Evaluation
A lot of basic syntax in here. You’ll learn about the concept of functions as first class citizens, evaluation strategies and tail recursion.
Composing functions using other functions, currying
How to compose more complex data structures, polymorphism
Functions as objects (everything is an object!), subtyping, generics, pattern matching
Pairs, tuples, higher order functions on lists (such as map and filter),
Collections other than lists, such as maps and sets. for comprehensions (not your standard for loop!)
Trees, streams, lazy evaluation.
I can’t say enough good things about this class. The material was interesting, the assignments were challenging, and I thoroughly enjoyed it.