Functional Programming is nothing new to JVM. But with Java 8 it was the big change in paradigm for Java developers. Switching from imperative to functional opens new ways in writing more maintainable code.

Since middle 90s Java has changed. To keep pace with other programming languages it evolves from nearly pure object-oriented to more complex, partly functional, [multi purpose] industry standard. Java Virtual Machine has become a mature environment that gave birth to a bunch of modern languages like Scala, Kotlin or Groovy and reincarnation of proven one's - Closure (LISP), Frege (Haskell) not mentioning ports like Jython, JRuby.

With Java 8th edition comes lambda expression, functions, interface improvements. It is time to review design patterns and start thinking in functional Java.

Object vs Functional
Imperative Declarative
Mutability Favors Immutability
Boilerplate code Expressive
Reveals impl. details Hides impl. details
Eager by default Lazy by default
nulls Optionals
Hierarchy of types Function composition

Let me share with you a teaser presentation on why functional approach can make your code go to the higher level.

Quick and neat way to initialize a Map with lambda

Decorator Pattern done with function composition

JDK 8 Massive Open and Online Course: Lambdas and Streams Introduction

Functional Java Patterns

Download slides

Enjoy coding

Krakow, winter 2017

blog comments powered by Disqus