Functional Java by Example | Part 6 – Functions as Parameters

This is part 6 of the series called “Functional Java by Example”.

The example I’m evolving in each part of the series is some kind of “feed handler” which processes documents. In previous part we tried to make our functions as pure possible by moving as much of the side-effects, such as IO, to the outside of the system.

Now we’re going to replace some of our abstractions into functions, to be passed as parameters.

Continue reading “Functional Java by Example | Part 6 – Functions as Parameters”

Functional Java by Example | Part 3 – Don’t Use Exceptions to Control Flow

This is part 3 of the series called “Functional Java by Example”.

The example I’m evolving in each part of the series is some kind of “feed handler” which processes documents. In previous parts I started with some original code and applied some refactorings to describe “what” instead of “how”.

In order to help the code going forward, we need to get rid of the good ol’ java.lang.Exception. (disclaimer: we can’t actually get rid of it) That’s where this part comes in.

Continue reading “Functional Java by Example | Part 3 – Don’t Use Exceptions to Control Flow”

Functional Java by Example | Part 2 – Tell a Story

This is part 2 of the series called “Functional Java by Example”.

The example I’m evolving in each part of the series is some kind of “feed handler” which processes documents. In previous part I started with some original code and applied some refactorings to describe “what” instead of “how”.

In order to help the code going forward, we need to tell a story first. That’s where this part comes in.

Continue reading “Functional Java by Example | Part 2 – Tell a Story”

Functional Java by Example | Part 1 – From Imperative to Declarative

Functional Programming (FP) is about avoiding reassigning variables, avoiding mutable data structures, avoiding state and favoring functions all-the-way. What can we learn from FP if we would apply functional techniques to our everyday Java code?

In this series called “Functional Java by Example” I will refactor in 8 installments an existing piece of code to see if I can reach Functional Nirvana in Java.

Continue reading “Functional Java by Example | Part 1 – From Imperative to Declarative”