Please enable JavaScript.
Coggle requires JavaScript to display documents.
Design Pattern (Intermediate Design Patterns (Iterator Pattern (Parts…
Design Pattern
-
Advanced Design Patterns
-
Composite Pattern
-
Example an Array is a composite. The component is the Array itself. The composite is a private container used by Array to contain leaf objects. Each leaf is a concrete type such as Int, String...
A Structural pattern that groups a set of objects into a tree structure so that they may be manipulated as though they were one object
When to use
If your app's class hierarchy forms a branching pattern. You can solve this problem with the composite pattern by treating branches and nodes the same by making them conform them to a protocol
-
Mediator Pattern
Parts
Mediator the object that controls the communication of the colleagues. It implements the mediator protocol
-
-
Colleagues: the objects that want to communicate with each other, they implement the colleague protocol
-
When to use
To separate interactions between colleagues into an object, the mediator
-
-
-
-
-
-