Motivation Frequently programmers develop systems in which a component may be an individual object or it may represent a collection of objects. Intent Compose …
What is iteration? In computer science, an iterator is an object which allows a programmer to traverse through all the elements of a collection, regardless of …
Motivation To reduce the size of a class that has many methods. Also to allow step-by-step construction of a target object. Intent Separate the construction of …
Motivation Sometime a toolkit class that’s designed for reuse isn’t reusable only because its interface doesn’t match the domain-specific interface an …
Motivation Structuring a system in to subsystem helps reduce complexity. A common design goal is to minimize the commutation and dependencies between systems. …
Motivation There are cases in programming where it seems that you need to generate a very large number of small class instances to represent data. Sometimes …
Motivation It is important for some classes to have exactly one instance. As an example although there can be many printers in a system, there should be only …
Motivation Object-oriented developers strive to keep object loosely coupled, keeping the responsibility between objects specific and minimal.. This leads to …
Definition Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. …
Intent Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for extending functionality. …