O'Reilly logo

Scala Functional Programming Patterns by Atul S. Khot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Of Visitors and Chains of Responsibilities

In this chapter, we will look at two important design patterns, namely visitors and chains of responsibilities. These patterns help us model real-world scenarios in a pretty neat fashion. Let's first look at the problem domain.

Rakesh and Nita are happily married. One fine evening, Rakesh gets pleasantly surprised as Prakash comes visiting. Prakash is his childhood buddy and is in town on business. Prakash gets to know of Rakesh living in the same town and comes home, and the buddies meet after a span of many years. Prakash is meeting his friend's wife for the first time, though. They greet each other, well, a little formally. Prakash and Rakesh, on the other hand, back slap each other and enquire ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required