GofPatterns Gofpatterns  





Design Patterns  «Prev  Next»
Three Categories of Design Patterns

Three types of design patterns

Node.js Design PatternsNode.js Design Patterns
  1. Behavioral: Describe interactions between objects. They focus on how objects communicate with each other.
    Behavioral object patterns use object composition rather than inheritance. Some describe how a group of peer objects cooperate to perform a task that no single object can carry out by itself. An important issue here is how peer objects know about each other. Peers could maintain explicit references to each other, but that would increase their coupling. In the extreme, every object would know about every other.
    The Mediator pattern avoids this by introducing a mediator object between peers.
    The mediator provides the indirection needed for loose coupling.
  2. Creational: Make objects of the right class for a problem, generally when instances of several different classes are available.
    There are two recurring themes in creational patterns. First, they all encapsulate knowledge about which concrete classes the system uses.
    Second, they hide how instances of these classes are created and put together.
    All the system at large knows about the objects is their interfaces as defined by abstract classes. Consequently, the creational patterns give you a lot of flexibility in what gets created, who creates it, how it gets created, and when. They let you configure a system with "product" objects that vary widely in structure and functionality. Configuration can be static (that is, specified at compile-time) or dynamic (at run-time).
  3. Structural: Form larger structures from individual parts, generally of different classes.
    Rather than composing interfaces or implementations, structural object patterns describe ways to compose objects to realize new functionality.
    The added flexibility of object composition comes from the ability to change the composition at run-time, which is impossible with static class composition.