O'Reilly logo
live online training icon Live Online training

Understanding Functional Programming

Transitioning Java from imperative to functional

Topic: Software Development
Venkat Subramaniam

The imperative style of programming is more common in Java, but a functional programming approach has less accidental complexity. Syntactically, code is more concise and elegant when written in a functional style. Semantically, functional code has fewer bugs and is easier to parallelize. Yet we Java programmers struggle to embrace functional style.

Join expert Venkat Subramaniam to learn how to combine and use the good parts of Java, the object-oriented paradigm, and the functional style of programming. You’ll learn to think functionally and leverage the powerful APIs of the JDK that are geared toward functional programming as you work to refactor a series of problems to use the functional style. The enemy isn’t the object-oriented style—it’s the accidental complexity that stems from the imperative style. Discover approaches and techniques for using functional style to reduce the complexity of your code, along with benefits, trade-offs, and practical examples that will point you in the right direction.

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

By the end of this live online course, you’ll understand:

  • The essence of functional programming
  • How to solve problems using a functional approach
  • How to break a problem into functional composition

And you’ll be able to:

  • Refactor Java code from the imperative to the functional style
  • Reduce the overall complexity of your code
  • Reduce errors and make your code easier to maintain

This training course is for you because...

  • You’re a Java developer, technical lead, architect, or hands-on manager.
  • You work with Java and highly complex applications.
  • You want to become better at dealing with complexity and reducing defects in code.

Prerequisites

  • A computer that’s capable of running Gradle builds to run automated tests
  • A working knowledge of Java 8 or newer
  • Download IntellJ IDEA Community Edition
  • Familiarity with general programming concepts

Recommended preparation:

Recommended follow-up:

About your instructor

  • Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., creator of agilelearner.com, co-founder of the devdotnext software conference, and an instructional professor at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly-invited speaker at several international conferences. Venkat helps his clients effectively apply and succeed with sustainable agile practices on their software projects. Venkat is a (co)author of multiple technical books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer. You can find a list of his books at agiledeveloper.com. You can reach him by email at venkats@agiledeveloper.com or on twitter at @venkat_s.

Schedule

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

Thinking in a functional style (60 minutes)

  • Presentation: Thinking in a functional style; transforming data
  • Group discussion: Functional composition and data transformation
  • Hands-on exercise: Refactor to use functional composition
  • Q&A
  • Break (5 minutes)

Exploring functional APIs (60 minutes)

  • Presentation: Exploring functional APIs
  • Group discussion: Looking for APIs that perform data transformations
  • Hands-on exercise: Refactor to use existing functional APIs
  • Q&A
  • Break (5 minutes)

Complex higher-order functions (60 minutes)

  • Presentation: Learning to use complex higher-order functions
  • Group discussion: Powerful functions for grouping and manipulating data
  • Hands-on exercise: Refactor to use complex functions for data manipulation
  • Q&A
  • Break (5 minutes)

map versus flatMap (60 minutes)

  • Presentation: When to use map; when to use flatMap
  • Group discussion: The nature of functions; when to use map versus flatMap
  • Hands-on exercise: Refactor to use flatMap
  • Q&A