Curriculum design patterns Design patterns 15-1 succinctly explain bridge mode

1 bridge mode to explain

1.1 Type:

1.2 Definitions:

1.3 application scenarios:

1.4 Advantages:

1.5 Disadvantages:

1.6 Relationship with other design patterns:

 

 

1 bridge mode to explain
1.1 Type:

Structural

 

1.2 Definitions:

◆ define: an abstraction and separation of part of its specific implementation, so that they can vary independently
◆ synthesized multiplexing principles mentioned: establish a link between two priority classes by the combination, instead of inheritance, excessive It happens like an explosion

 

1.3 application scenarios:

◆ between a concrete realization of the abstract and add more flexibility

 

Applicable bridge mode to avoid static build inheritance relationship between the two levels, establish a relationship between them through the bridge mode ,

 

Abstract part and a specific portion which can be implemented independently by inheritance extended manner and independently of each other, can be dynamically abstract object subclasses and realization of a subclass object, be combined.

We abstract the role and implementation of the object is to achieve a decoupling

◆ b exists a class two dimensions (or more) vary independently, and the two (or more) dimensions need to be extended independently
◆ C using inheritance undesirable, or the number of leads as a multilayer system classes inherit surge

 

1.4 Advantages:

◆ a portion separating the abstract and concrete realization section

It uses a combination of bridge mode, which means that the use of the relationship between the object and the object, to decouple the inherent binding relationship between the abstract and the implementation and realization of the abstract can be extended to vary along each dimension.

Abstract and achieve no longer an inheritance hierarchy in order to obtain a combination of multi-dimensional objects by combining
◆ b improved system scalability

Abstract or arbitrary extension in one dimension, do not need to change the existing system, the system automatically raises scalability
◆ c comply with the principles of the opening and closing
◆ d in line with the principle of multiplexing Synthesis

 

1.5 Disadvantages:

◆ increase system understanding and design difficulty
◆ need to correctly identify the two separate dimensions of the system changes

 

1.6 Relationship with other design patterns:

Bridging mode and a combined mode:

More emphasis mode combination compositions, bridge mode between the parts and the whole is emphasized that the parallel combination of different types of levels.

 

Bridge mode and the adapter mode:

Common: all work together to make two classes.

Different points: different purposes, the adapter is to change the interface, so that they can cooperate with each other; isolated bridge mode is abstract and concrete to achieve the purpose of separation.

Adapter mode can be functionally similar, but different adapter interface class together, bridge mode is the abstract and concrete classes of class separation, on the basis of these combined hierarchy

 

Guess you like

Origin www.cnblogs.com/1446358788-qq/p/11522158.html