OOP 소프트웨어 디자인은 소프트웨어 설계(Software Design)이 가장 중요하다. 나중에 설계를 변경하려고 해도 이미 늦기 때문이다. 이를 위해서는 처음에 설계를 잘 하던가 설계 자체를 flexible 하게 해야 한다. Design Pattern 은 설계를 잘 하기 위한 설계 패턴을 정리한 것이다.
[Design Pattern Catalog]
[Patterns Home Page]
Design Pattern Catalog
- Abstract Factory: provide an interface for creating families of related or dependent objects without specifying their concrete classes
- Builder: separate the construction of a complex object from its representation so that the same construction process can create different representations
- Factory: Method define an interface for creating an object, but let subclasses decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.
- Prototype: specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
- Singleton: ensure a class only has one instance, and provide a global point of access to it.
- Adapter: convert the interface of a class to a different interface that the client expects. Adapter lets classes work together that couldn't otherwise because of imcompatible interfaces.
- Bridge: decouple an abstraction from implementation so the two can vary independently.
- Composite: compose objects into tree structures to represent part-whole hierarchies. Composites lets clients treat individual objects and compositions of objects uniformly.
- Decorator: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. (extend object functionality dynamically)
- Facade: provide a new simpler interface for a set of object interfaces
- Flyweight: use sharing to support a large number of small objects efficiently
- Proxy: provide a surrogate for another object to control access to the object
- Chain of Responsibility: provide multiple linked request handlers to avoid coupling request sender with receiving object
- Command: encapsulate requests as an object
- Interpreter: translate a language into executable operations
- Iterator: provide a way to sequentially access elements of an aggregate without exposing the underlying representation of the aggregate
- Mediator: define an object that defines how a set of objects interact
- Memento: save an objects internal state so it can be restored later
- Observer: define a ont-to-many dependency between objects so that when one object changes state, all its dependents are notified and ipdated automatically. (define a one to many relationship providing broadcast of an objects state changes to all dependent objects)
- State: allow an object to alter behavior based on object state
- Strategy: define a family of algoritms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. (define a set of interchangeable algorithms)
- Template Method: define the skeleton of an algorithm in an operation, deferring some steps to subclasses. (i.e. Ada generic)
- Visitor: represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.