Spring 5 Design Patterns
上QQ阅读APP看书,第一时间看更新

Examining the core design patterns

Let's continue our journey into the core design patterns:

  • Structural design pattern: Patterns under this category deal with the composition of classes or objects. In the enterprise application, there are two common techniques for reusing functionality in object-oriented systems as follows:
    • Inheritance: It is used to inherit commonly used states and behaviors from other classes.
    • Composition: It is used to compose the other objects as instance variables of classes. It defines ways to compose objects to obtain new functionalities.
  • Behavioral design pattern: Patterns under this category characterize the ways in which classes or objects interact with and distribute responsibility. These patterns define the methods of communication between the objects in the enterprise application. So here, you will learn how to use behavioral patterns to reduce complicated flow control. Furthermore, you will use behavioral patterns to encapsulate algorithms and dynamically select them at runtime.