liveBook · Manning

Functional programming

As explained in Microservices Patterns, Second Edition

Functional-style programming is a programming approach that emphasizes functions with limited side effects and minimizes dependencies on mutable state.

Functional-style programming limits side effects and dependencies on mutable state. In testable designs, it keeps complex business logic independent of infrastructure so it can be tested quickly and deterministically. section 5.4.3 section 5.4.4

Use the style to make tests simpler and faster:

  • Keep business logic free of dependencies so unit tests can run in memory instead of relying on heavyweight infrastructure. section 5.4.4
  • Use dependency injection and test doubles for troublesome external dependencies; functional-style logic can then be tested without those dependencies. section 5.4.3 section 5.4.4

How Microservices Patterns, Second Edition covers it

How deep it goes
Connects dependency-free business logic to fast unit tests, without detailing implementation mechanics.
Examples
Uses business logic without dependencies and a mock DAO as examples of targets for fast unit tests.
What you can do after
Apply the style by isolating business logic from dependencies for fast in-memory unit testing.
How it connects
Links functional-style programming with dependency injection, test doubles, unit tests, and integration tests.

Also explained in

Compare how 22 books explain functional programming →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.