JavaWhat are the common design patterns? Describes the Factory mode.
Total at species, divided into three categories: creation, structural, behavioral
I only remember the usual ones. 6 , 7 species, respectively:
Created (Factory, factory method, abstract factory, Singleton)
Structural type (packaging, adaptors, combinations, proxies)
Behavior (Viewer, template, strategy)
then talk about your understanding of the patterns you are familiar with.
Java in the at mode of design:
Factory (Factory mode), Builder (construction mode), Factory Method (factory method mode),
Prototype (original model mode), Singleton (singleton mode), facade (façade mode),
Adapter (Adapter mode), Bridge (bridge mode), Composite (synthetic mode),
Decorator (decorative mode), Flyweight (enjoy meta mode), Proxy (proxy mode),
Command (Command mode), Interpreter (interpreter mode), Visitor (visitor mode),
Iterator (iterative sub-mode), Mediator (mediator mode), Memento (Memo mode),
Observer (Viewer mode), State (state mode), Strategy (Policy mode),
Template Method (Template method mode), Chain ofresponsibleity (responsibility chain mode)
Factory mode: Factory mode is a frequently used pattern, and classes implemented according to the factory pattern can generate an instance of a class in a set of classes based on the data provided, usually this group of classes have a common abstract parent class and implement the same method, but these methods have different operations for different data. First, you need to define a base class in which subclasses implement methods in the base class in different ways. Then you need to define a factory class where the factory class can generate different subclass instances based on the criteria. When an instance of a subclass is obtained, the developer can call a method in the base class without having to consider which instance of the subclass is returned.
Introduction to Java common design patterns and factory models