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 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.