Examples of behavioral design patterns

  • Chain of responsibility - Designed for an organization within a system of levels of responsibility.
  • Command - Represents an action. The command object contains the action itself and its parameters.
  • Interpreter - Solves a frequently encountered but subject to change problem.
  • Iterator - It is an object that allows you to get sequential access to the elements of an aggregate object without using the descriptions of each object included in the aggregation.
  • Mediator - Enables many objects to interact while creating loose coupling and eliminating the need for objects to explicitly reference each other.
  • Keeper (Memento) - Allows, without breaking the encapsulation, to fix and save the internal states of the object so that later it can be restored in these states.
  • Observer - Defines a one-to-many dependency between objects so that when the state of one object changes, everyone that depends on it is notified of the event.
  • State - It is used in cases when during program execution the object must change its behavior depending on its state.
  • Strategy - Designed to define a family of algorithms, encapsulate each of them, and ensure they are interchangeable.
  • Template method - Defines the basis of the algorithm and allows inheritors to override some steps of the algorithm without changing its structure as a whole.
  • Visitor - Describes the operation that is performed on objects of other classes. When changing the Visitor class, there is no need to change the serviced classes.

Read also:


Comments

Popular posts from this blog

Methods for reading XML in Java

XML, well-formed XML and valid XML

ArrayList and LinkedList in Java, memory usage and speed