The next edition of the workshop will be in Italian. Please visit the Italian page of the workshop for the most up-to-date information.
The workshop Applied Functional Programming by Matteo Baglini is structured to put functional programming into practice. It is aimed at those who have already tasted this paradigm and want to take a leap forward in its adoption.
Even if we deal with abstract and mathematical topics, including the famous Monads, the workshop maintains an extremely practical approach: the right level of theory and lots of coding sessions. We will work with TypeScript.
Objective of the course: understanding in a simple and pragmatic way how to concretely apply pure functional programming techniques and principles using Typescript.
Target audience
The workshop is aimed at professional software developers, both in the back-end and front-end, with a medium/high level of experience with mainstream languages such as Java/Kotlin/C#, and obviously TypeScript, and who have already come into contact with the functional world (and concepts such as immutability, high-order functions, List manipulation via map/filter/reduce/etc functions).
We will make use of concepts considered advanced in the aforementioned programming languages (such as Generics). Therefore this course is not suitable for those who are starting their journey in the world of programming.
Topics
Some of the topics we will cover:
- understanding the impact of working with referential transparency
- designing large systems as the sum of small compostable units
- model behaviors, constraints and domain data using functions and algebraic data types
- obtaining an understanding of the main functional structures: Functor, Applicative, Monad, Foldable and Traversable
- building a complete application with infrastructure, domain and testing.
Program
The workshop aims to provide participants with a practical mastery of the main concepts and principles underlying pure functional programming, to make the most of these techniques in everyday life with their own programming language and technology stack.
Together, we will study and use functional structures while building a complete application, following good design patterns and a separation of responsibilities.
Each session is supported by the code that will be written during the workshop working in small autonomous groups and reviewed together with the support of the trainer.
Agenda
Session 1 – Let’s lay the foundations
- Functional Programming – Introduction and benefits
- Building blocks – modules, functions and algebraic data types
- Pattern matching and multiple dispatch.
Session 2 – Let’s build an application from scratch (part 1)
- Introduction to the application
- Let’s see the different architectural layers
- Type-driven design of the domain – bottom-up approach
- Let’s implement the domain behaviours
- Micro testing – testing the domain only.
Session 3 – Side-effects
- Side-effects – how to introduce them in a side-effect-free system
- Functor and Monad – mastering the key combinators
- Custom Monad – developing a not-built-in monad from scratch
- Catalogo Monadi – vediamo le differenti semantiche
- Applicative, Foldable and Traversable – other combinators.
Session 4 – Let’s build an application from scratch (part 2)
- Exposing the domain via infrastructure
- Macro testing – acceptance test of the application
- Run it – let’s see it running
- Wrap up – final notes.
Learning objectives – What are we gonna learn
- Put Functional Programming concepts into practice
- Define domain constraints using the type system
- Choose whether and which Monad to use for a specific use case
- An in-depth knowledge of various concepts orthogonal to the programming language that you can immediately exploit in your current application stack
- Warning: This is not a course to learn Typescript or a particular framework/library.
Expect to get your hands dirty – How it works
The key word of this workshop is “practice”: the theoretical moments will be few, but essential. The split will be more of less 30% theory and 70% practice.
We will build an application from scratch and use the difficulties we will gradually encounter as leverage to introduce and delve deeper into the various building blocks.
The course will take place online and live streaming for a maximum of 12 people: the trainer and all participants will be in a video conference and will have a series of digital tools available to interact with each other and work hands-on.
Despite the online mode, the course maintains its interactive and participatory approach.
For this reason, it is required that all participants have their cameras turned on for the entire duration of the workshop for better communication.
It will not be a passive course, made only of slides and pre-recorded videos.
We will apply some principles of the Training from the back of the room method, which emphasizes activities over lectures.
Finally, sharing between participants and the support of the trainer complete the training framework.
Why should I buy a ticket?
This workshop will allow you to delve deeper into the principles underlying functional programming and experience software development in a functional style, thanks to exercises, examples, and group discussions.
Matteo will give you the tools to help you evaluate the pros and cons of functional programming in a more objective manner: the final decision on whether or not to make the leap is up to you!
Programming language – TypeScript
We will use Typescript (TS) during the workshop, and we will use the following libraries:
- fp-ts (https://github.com/gcanti/fp-ts): abstraction for functional programming,
- effect (https://github.com/Effect-TS/effect): functional effect system,
- ts-pattern (https://github.com/gvergnaud/ts-pattern): all-round pattern matching support.
An intermediate knowledge of TypeScript is required to participate in this course. Participants must be familiar with:
- tool chain tsc, ts-node, ts-jest, npm/yarn, etc.
- primitive types: string, number, any, Array, etc.
- define custom type alias and interface.
- spread operator and restructuring.
- the many ways to define a function.
- use high-order functions (come array map or filter).
- union, literal and tagged union types.
- type narrowing.
- generic types and functions.
A good starting point is the following e-book, which you can download for free: Typescript Handbook.
Programming language – TypeScript
During the workshop, you will need to work on your laptop, therefore please make sure you instal the following:
- Git (and graphic client, if needed) to clone the repo https://github.com/doubleloop-io/applied-fp-workshop-ts or one of its forks,
- NodeJs, an LTS version of the 16.x or 18.x series,
- Yarn, a version of the 1.22.x series,
- an IDE, such as WebStorm, or an editor like Sublime, Visual Studio Code, Vim or Emacs, with their plugin/language server protocol installed.