Tackle Your Object-Oriented Code with a Functional Mindest & Techniques

Learn how to get the most out of Java's ever growing functional types and tools without needing to go fully functional

What You Will Learn

Java developers usually tackle the complexity of software development through object-oriented programming (OOP). But not every problem is a good match for OOP.

The functional programming (FP) paradigm offers you another approach to solving problems, and Java provides easy-to-grasp FP tools such as lambda expressions and Streams. If you're interested in applying FP concepts to your Java code, this book is for you.

You will learn about many functional concepts and their importance and how to utilize them directly in your Java code:

  • Composition: Build modular and easy composable blocks.
  • Expressiveness: Write more concise code that clearly expresses its intent.
  • Safer code: Safer data structures without side effects that don't need to deal with race conditions or locks, which are hard to use without introducing bugs.
  • Modularity: Break down larger projects into more easily manageable modules.
  • Maintainability: Smaller functional blocks with less interconnection make changes and refactoring safer without breaking other parts of your code.
  • Data manipulation: Build efficient data manipulation pipelines with less complexity.
  • Performance: Immutability and predictability allow scaling horizontally with parallelism without much thought about it.
Even without going fully functional, your code will benefit from the concepts and idioms presented in this book. And not only your Java code. You will tackle development challenges with a functional mindset, improving your programming regardless of the used language or paradigm.

Table of Contents

Part I: Functional Basics

Introduces the history and core concepts of functional programming, how Java implements these concepts, and what types are already available to us as developers.

  • An Introduction to Functional Programming
  • Functional Java
  • Functional Interfaces of the JDK

Part II: A Functional Approach

A topic-based deep-dive through the more generalized programming concepts and how to augment them with functional principles and the newly available tools. Certain features, like Records and Streams, are highlighted with extended examples and use cases.

  • Immutability
  • Working with Records
  • Data Processing with Streams
  • Working with Streams
  • Parallel Data Processing with Streams
  • Handling null with Optionals
  • Functional Exception Handling
  • Lazy Evaluation
  • Recursion
  • Asynchronous Tasks
  • Functional Design Patterns
  • A Functional Approach to Java

Who's the book for?

You are curious about functional programming and want to know what all the fuss is about and apply it to your Java code. Maybe You're already using some functional Java types but desire a more profound knowledge of why and how to apply them more effectively.

No need to be an expert on OOP, but the book is not a beginner’s guide to Java or OOP either. You should already be familiar with the Java standard library.

No prior knowledge of functional programming is required, as every concept is introduced with an explanation and examples.

This book might not be for you if you are looking for a compartmentalized, recipe-style book presenting “ready-to-implement” solutions. Its main intention is to introduce functional concepts and idioms and teach you how to incorporate them into your Java code.

Hi, I'm Ben!

I'm a self-taught software developer with almost two decades of experience in professional web, mobile, and systems programming in various languages.

After learning the ropes of professional software development and project management at a clinical research organization, I started my own business, and I'm now director of a Java-based SaaS company.

Besides trying to share my expertise and experiences by writing articles about Java, functional programming, best practices, etc., I also actively participate in Open-Source, either as a committer to established projects or by releasing my own code.

Ben Weidig

Get your copy of the book now!