Scala Summer Camp #2: FP for Java programmers


Details
Scala Summer Camp is back! It's a series of 3h long functional programming workshops in July, August, and September.
#2: Functional Programming for Java Programmers
If you have ever found yourself late at night debugging some impossible bug that "shouldn't have happened", only to find out that it was all about some obscure global state change, come join us and see what FP has to offer.
During this workshop, you will learn how to deal with your worst enemies: shared mutable state and code you can't trust. You will do a set of exercises that focus on dealing with these problems using Java whenever possible and Scala in more advanced cases. You will learn the two fundamental tools of functional programming: pure functions and immutable values.
This event is open for all programmers that know the basics of OOP in Java. Scala knowledge is not required. We will introduce & use only the very basic syntax constructs.
Requirements:
- your own laptop,
- git, IntelliJ, JDK 8+, Scala 2.13 and sbt 1.2.8 installed.
Agenda:
- What is a function?
- Exercise: Imperative vs Declarative
- Functions in Scala
- Exercise: Functions in Scala
- Coding imperatively
- Pure function: imperative vs functional
- Exercise: Refactoring to a pure function
- Pure functions and clean code
- Exercise: Pure or impure?
- Using Scala to write pure functions
- Testing pure functions
- Exercise: Testing pure functions
- Mutability is dangerous
- Exercise: Getting burnt by mutability
- Shared mutable state
- Dealing with the moving parts
- Building our intuitions about immutability
- Exercise: Immutable String API
- Purely functional approach to the shared mutable state
- Exercise: Practicing immutable slicing and appending
- Exercise: Purely functional approach to the shared mutable state
About your instructor: Michał Płachta (https://michalplachta.com)
Polyglot programmer & functional programming enthusiast who loves the human component in software projects. He speaks at conferences, runs workshops & organizes meetups to help others get better at delivering maintainable software.
About Scala Summer Camp
Scala Summer Camp was initiated in 2017. Its main objective is to popularize techniques that lead to more maintainable software. It aims to attract coders at each level of experience.
This year we are planning to host several workshops on different topics. Here's a list of topics that we want to cover:
- Using Functional State in Actors (23.07, 20 participants),
- Refactoring Imperative to Functional (this workshop),
- Abstracting over IO,
- Consistency using ZIO STM,
- Simplifying services using Service Mesh,
- Optimizing services using recursion schemes & IO.
They will all be held during workweek afternoons. Please keep an eye out for invitations, because the number of places is limited.

Scala Summer Camp #2: FP for Java programmers