O'Reilly logo
live online training icon Live Online training

Functional Programming for Java Developers: Making Effective Use of Lambdas and More

Simon Roberts

The goal of this ​introduction to functional concepts is to quickly teach Java developers how to leverage the power of lambdas and other features introduced in Java 8 & 9.

This live training course is presented using the syntax and new features first introduced in Java 8, but is primarily focused on giving you a practical understanding of the deep power of functional programming. Featuring real-world examples, the course is heavy on understandability and practicality, and light on academic formality.​

What you'll learn-and how you can apply it

  • Benefits and uses of the function as a first class language citizen:
  • Passing functions as parameters to other functions
  • Returning functions from a function
  • Functions that modify other functions
  • Designing software using functions, rather than classes, as minimum units of code reuse
  • Benefits and challenges of immutable data and pure functions
  • Learn the syntax needed to implement all these ideas in Java 8, even in the face of checked exceptions!

This training course is for you because...

  • You might be a software engineer working with a language that supports but does not require functional design (for example, Java or JavaScript, and you’d like to start benefitting from what this paradigm has to offer
  • You’re a Java programmer looking to make use of the features added in Java 8
  • You just want to find out a bit about what the “functional fuss” is all about

Prerequisites

  • You should be comfortable reading code written in the Java programming language, in particular, with the use of interfaces in that language
  • You should understand basic software design concepts such as the separation of concerns

Recommended Preparation:

OCA Java SE 8 Programmer (1Z0-808) Complete Video Course

Module 10, lesson 5

Modern Java Collections LiveLesson

Lessons 7

Lesson 10

Lesson 14

Class Materials:

  • Some practical exercises will be suggested during the course. You’re free to attempt these in any language you choose, but assistance and examples from the instructor will be in Java
  • Source code repository on github.com will be used to distribute examples and other materials created during the course

About your instructor

  • Simon started out working as a software engineer, specializing in industrial control systems, and had a sideline teaching for a local University in his then-home-town of Cambridge, England.

    In 1995 he joined Sun Microsystems, Inc. as a senior instructor and course developer. Simon spearheaded the introduction of Java training by Sun Microsystems in the U.K. in 1995. He developed the first Java certification exams for Sun before he moved to the U.S. in 1998.

    Since leaving Sun in 2004, Simon has developed and delivered training for clients around the world.

    Simon believes that training should have an immediate purpose and application, and that the most effective training is usually "on the job" mentoring, helping to remove the immediate roadblocks to productivity that so often plague workers in fast moving environments.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Day 1

Segment 1 From an OO design pattern to a functional foundation (60mins)

  • In this segment we’ll investigate a familiar problem that has a solution that is generally well understood in OO design. We’ll investigate that solution and discover that it’s actually a functional solution. From there we’ll build the foundations of perhaps the most central perspective of functional design.

Break 10 minutes

Segment 2 Building more functional concepts (95mins)

  • In this segment we will expand our investigation of our core functional concept, looking at some more object oriented design considerations, and how they lead to functional solutions.

Break at midpoint, 15 minutes

Day 2

Segment 3 Solidifying Java syntax (40mins)

  • In this segment we will shift gears and look at the syntax mechanisms that are provided by Java that support functional approaches. Although the syntax is of course specific to Java 8, discussions of the intent of the syntax will not be.

Break 10 minutes

Segment 4 The power of combinations and modifications (60mins)

  • In this segment we will investigate the enormous power that can arise from reusing functional code. As with other design styles, units of code in a functional design can be combined, and can be wrapped so their behavior is altered. And, perhaps more so than in other design styles, the effect of such combinations and modifications can be incredibly powerful. This segment also discovers how functional programming handles Java’s checked exception mechanism.

Break 10 minutes

Segment 5 Working with pure functions (60mins)

  • This segment delves into another of functional programming’s core paradigms, one that’s often overlooked because it can seem inconvenient. That is the idea of a pure function. Programming with pure functions can seem a little mind-bending, particularly at first, but there are several benefits that can accrue from them, and even a limited application of the idea can provide many of those benefits in practical systems. During this investigation, we’ll also take a look at several key aspects of Java 8’s new APIs, including the Optional class, and the Streams API.

Final Q&A