Create mode:
8. Lei Feng is still in the world---factory method mode
Defines an interface for creating objects, letting subclasses decide which class to instantiate. The factory method delays the instantiation of a class due to subclasses.
9. Resume Copy---Prototype Mode
13. Every good dish has a different aftertaste---builder mode
Separating the construction of a complex object from its representation allows the same construction process to create different representations.
15. Can I not pay back the DB? ---Abstract factory pattern
21. Some classes also need family planning---singleton mode
Structural Patterns:
6. What is so important to wear? --- Decorative Mode
To dynamically add some additional responsibilities to an object, the decorator pattern is more flexible than subclassing in terms of adding functionality.
7. Making wedding dresses for others---agent mode
Provides a proxy for other objects to control access to this object. That is, introduce a certain degree of indirection when accessing objects, and because of this indirection, multiple uses can be attached.
Application scenarios:
Remote Proxy - Provides a local representation for an object in a different address space. This hides the fact that an object exists in a different address space.
Virtual proxies - create expensive objects on demand. It is used to store real objects that have been instantiated for a long time.
Security proxies - used to control permissions when accessing real objects.
12. Will bull market stocks still lose money? ---Appearance Mode
Providing a consistent interface for a set of interfaces in a subsystem, this pattern defines a high-level interface that makes the subsystem easier to use.
17. In NBA I need translation---adapter mode
Convert the interface of a class to another interface that the client wants. The adapter pattern enables classes to work together that would otherwise not work together due to incompatible interfaces.
19. Branch = one department---combination mode
Group objects into tree structures to represent part-whole hierarchies. The composite mode allows users to use individual objects and composite objects consistently.
22. When will the mobile phone software be unified---bridge mode
Separate the abstraction from its implementation so that they can both be changed independently. Separation of abstraction from its implementation doesn't mean to separate an abstract class from its derived classes, because it doesn't make any sense. Implementation refers to the objects an abstract class and its derived classes use to implement their own.
26. Don't be silly if you have too many projects---Flyweight mode
Use sharing techniques to efficiently support a large number of fine-grained objects.