Is the Composite Pattern SOLID?
问题 A Leaf in the Composite Pattern implements the Component interface, including Add , Remove , and GetChild methods that a Leaf is never going to use. This seems to be a violation of the Interface Segregation Principle. So is the usage of Composite Pattern SOLID? link to Composite Pattern: http://www.dofactory.com/Patterns/PatternComposite.aspx 回答1: The real smell in the pattern as depicted in your link and most books is that Component has the methods of a Composite . I think this is probably