Making the most of Scala through functional programming
Afternoon | 14:30 - 18:30
You may have already experienced that Scala allows you to write programs as if you were still using Java. While this has unquestionable benefits in terms of lowering entry barriers to newcomers, it may also cause you to forget that the significant source of power for Scala lies elsewhere, namely, in its support for functional programming. This workshop will introduce three major functional abstractions that will bring you to the next level of programming maturity: higher-order functions, type classes and monadic functions; and, more importantly, it will show you why they matter so much, i.e. how they help you to achieve unprecedented levels of reuse and modularity, while keeping your programs concise and understandable.
In order to introduce each of these programming abstractions, we will proceed through the following steps:
- First, we introduce a simple programming exercise.
- Second, we solve this exercise using conventional techniques.
- Third, we unveil the problems of this preliminary solution (e.g. in
terms of lack of modularity, reuse, testability, etc.)
- And, fourth, we apply the functional abstraction to solve that very
same problem, and show how and in which sense, the functional
solution exposes a better design.
According to this procedure and the techniques covered in the course, we will challenge many of the techniques you may already be used to. In particular, will will show how you can reuse or design your own higher-order functions to get rid of for-loops using mutating
variables, thus obtaining more reusable and understandable programs; how you can dismiss most uses of both inheritance and delegation by using type classes, getting rid of the extensibility problems faced by those techniques; and last, how you can implement truly reusable API-based functions by using Monads and type class-based APIs, instead
of plain conventional abstract interfaces.
- What is functional programming?
- Higher-order functions
- Type classes
- Purely functional APIs
Bring your own laptop with a clone of the following Github repository:
The teachers will provide a LinkedIn certificate of attendance.
Object-oriented programmers (e.g. Java, Python, C#, etc.) with some exposure to the Scala programming language: at the very least, you should be comfortable with the basic syntax of the language.
Bio of the instructor:
Juan Manuel is CTO and co-founder of Habla Computing. He has been
using Scala for the last six years and has extensive experience in
consultancy projects with Scala and its functional ecosystem
(scalaz/cats, shapeless, etc.). He founded and manages the Madrid
Scala Meetup group and is member of the organizing committee of Lambda
World, the premier Spanish conference of functional programming for
the software practitioner.
Bio of the instructor:
Javier is a senior functional programmer and trainer at Habla
Computing. Scala is his native language both for functional and
object-oriented programming since the beginning of his professional
career. He boasts not ever having the need to learn Java and similar
non-functional languages to make a living.
WOULD YOU LIKE TO JOIN OUR TRAINING PROGRAM?