Chapter 4. Behavioral Patterns

In the preceding chapters, we discussed how we can create objects or structure our code to enhance its modularity and reusability. This chapter focuses on design patterns to enable communication between objects and keep them loosely coupled at the same time.

Introducing these design patterns in code increases their flexibility and reusability in order to carry out the communication between objects. It mostly focuses on how an object interacts and how responsibilities are shared amongst them.

We should consider using behavioral patterns in the following scenarios:

  • Passing same request to multiple handlers
  • Implementing object-oriented callbacks
  • Persisting and recovering the state of an object
  • Parsing languages or defined ...

Get Apex Design Patterns now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.