"Design Model Design Pattern" reading notes

xiaoxiao2021-03-06  15

"Design Model Design Pattern" reading notes

Composite mode

purpose

In a Part-Whole inheritance structure, the overall (Object, Component) is treated uniformly. In this way, the same operation can be performed without the use of the CLIENT.

structure

discuss

1. A disadvantage is that it is difficult to restrict Component in CompositeTe.

2, sometimes adding a Parent Reference will be more useful; however, if Component is able to share, it will bring multiple Parent issues, and the Flyweight mode provides a solution that does not need to save the Parent Reference.

Reference

"Design Pattern" Gang-Of-4 1997

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

New Post(0)