Skip to content

Scala Summer Camp #2: FP for Java programmers

Photo of Michał Płachta
Hosted By
Michał P. and Michał P.
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:

  1. What is a function?
  2. Exercise: Imperative vs Declarative
  3. Functions in Scala
  4. Exercise: Functions in Scala
  5. Coding imperatively
  6. Pure function: imperative vs functional
  7. Exercise: Refactoring to a pure function
  8. Pure functions and clean code
  9. Exercise: Pure or impure?
  10. Using Scala to write pure functions
  11. Testing pure functions
  12. Exercise: Testing pure functions
  13. Mutability is dangerous
  14. Exercise: Getting burnt by mutability
  15. Shared mutable state
  16. Dealing with the moving parts
  17. Building our intuitions about immutability
  18. Exercise: Immutable String API
  19. Purely functional approach to the shared mutable state
  20. Exercise: Practicing immutable slicing and appending
  21. 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.

Photo of Krakow Scala User Group group
Krakow Scala User Group
See more events
Coworking Rynek Główny 28
Rynek Głowny 28 · Kraków