Java design pattern "learning experience

zhaozj2021-02-17  61

Java design patterns "of the learning experience: Itabashi Azeri whole design pattern throughout a principle: the face of the programming interface, rather than face the realization (object-oriented programming interface for programming should be changed). The target principle is: reducing coupling and enhances flexibility. Factory (factory methods and abstract factories) for creating mode design modes (factory methods and abstract factories) use factory models as frequent as New. The prototype (prototype) of design mode specifies the type of the object to create the item, and create a new item by copying these prototypes. The BUILDER car in the design pattern consists of many parts of the wheel steering wheel. At the same time, it is also a complicated work to assemble these parts into a car. The Builder mode is to separate these two situations. Design mode Singleton (single) guarantees that only one instance is only one instance and provides a global access point structure mode design mode for a global access point structure mode Design mode, which uses JDBC to programmatically programming, Facade provides a flexible implementation. Proxy of Design Mode With jive as an example, analyzing the application design mode of the agent mode in the user-level authorization mechanism, using two ways of regeneration: combination (New) and inheritance (Extends), this already in "Thinking in Java" It is mentioned in it. Composite in the design pattern is to combine class tree structures into a unit. You introduce others to someone, you are an element in the unit element, and others do buyers with you, which is equivalent to buying in units. The JIVE is also analyzed in the article. Design mode DecoratorDecorator is a paint, giving your stuff's appearance brush a beautiful color. Bridges of design patterns are separated by "Cowherd" (this should be together, separate them, forming two interfaces), build a bridge (dynamic combination) design mode Flyweight provides Java operating performance, lowered and a large number of repetitions Overhead of the class. The Template of Behavior Design Mode is actually introduced to you why use Java abstraction class, which is simple, and it is very common. The Memento of the design pattern is very simple, that is, the copy of the original information is retained in the memory. Design Mode Observer Describes how to use the Java API's ready-to-build OBSERVER design pattern, a string of the class of each offered into a string, as if you can shoot flowers, of course, if you can complete it, don't be admitted to the next. Design mode COMMAN What is a behavior package, and Command is the best instructions. The State State of the Design Mode is an instance that is often encountered in the program, and the status of the status, sets the status converter, can be easily switched in the state. Strategy in the design pattern, different algorithms, each package, and the user can pick up the required algorithm. Design mode MediatorMediator is very like a traffic light in the crossroad, each vehicle is only necessary to interact with traffic lights. The Interpreter of Design Mode is mainly used to analyze the language, and there are not many applications. The Visitor Accessor of Design Mode The Visitor visitors complete a series of substantive operations and can be extended. The Iterator Iterator is already used to traverse objects in Collection. The frequency of use is high. There is no need to specifically explain in Java. In most cases, there is no need to create an Iterator yourself, just load the object into the Collection, we can use the Iterator mode.

转载请注明原文地址:https://www.9cbs.com/read-29767.html

New Post(0)