Curriculum design patterns Design patterns 12-1 succinctly explain adapter mode

1 The course explains

1.1 Type:

1.2 Definitions:

1.3 application scenarios:

1.4 Advantages:

1.5 Disadvantages:

1.6 Extensions:

1.7 Comparison with other design patterns

 

 

1 The course explains
1.1 Type:

Structural

 

1.2 Definitions:

Convert the interface of a class into another interface clients expect
◆ is not compatible with the original interface class can work together

 

1.3 application scenarios:

◆ existing classes, methods and needs when it does not match (the result of the same or similar method)
not software design stage design patterns to consider, along with software maintenance, due to the different products, different manufacturers to create similar functionality and interface is not the same solutions under the circumstances, is the software maintenance phase of things to consider

 

1.4 Advantages:

◆ to improve transparency and class reuse, reuse existing classes but do not need to change (to solve the problems existing class and target class mismatch)
◆ target adapter class and class decoupling, improve program scalability (not quite understand this meaning, see the code)
◆ in line with the principle of opening and closing

 

1.5 Disadvantages:

◆ Adapter writing process takes full account, it may increase the complexity of the system
difficult ◆ increase system code readable

 

1.6 Extensions:

◆ Object Adapter (in line with the principle of a combination of multiplexing and use delegation mechanism)
◆ class adapter (achieved through inheritance class)

 

1.7 Comparison with other design patterns

Adapter pattern and appearance modes:

They are a class of prior packaging existing systems, the former reuse legacy interface, which defines the new interface,

b former two interfaces so that the original work, which provides a more convenient access entry in the conventional system,

C adaptation of different intensity, which is adapted to the entire subsystem,

 

Guess you like

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