Chapter 10. Actors and Message Passing


"All the world's a stage, and all the men and women merely players: they have their exits and their entrances; and one man in his time plays many parts, his acts being seven ages."

 --William Shakespeare

Consider a simple, almost everyday use case—going to the market and buying vegetables. Do we know who grew the produce? Do we know which patch of land gave us this leafy food? We usually don't know about this.

On the other side of the coin, does the farmer who grew the crop and took such loving care of it know who bought his produce ultimately? He does not. He is content enough in knowing that his produce goes to the market.

This is essentially decoupling. The producer does know that there is a consumer somewhere ...

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.