The chain of responsibility

We looked at the command design pattern in Chapter 1, Grokking the Functional Way. There, the sender and executor are decoupled. Taking the idea further, we could have a pipeline of command objects that are linked together in a list. As in command, the sender submits a request. However, the request could be handled by any of the command objects in the pipeline.

We talked of moms and their kids and of kids and their mums. So the dads of the world united and started feeling left out. No worries, there is a place under the Sun for dads too! Dads have big responsibilities of dealing with stuff, in a world-wise fashion. In a family, thus, we have roles and responsibilities. Dads are used to fix broken things around the house, ...

Get Scala Functional Programming Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.