from learning javascript design patterns
http://www.phpied.com/3-ways-to-define-a-javascript-class/
Creational Design Patterns
Creational design patterns focus on handling object creation mechanisms where objects
are created in a manner suitable for the situation you are working in. The basic approach
to object creation might otherwise lead to added complexity in a project whilst these
patterns aim to solve this problem by controlling the creation process.
Some of the patterns that fall under this category are: Constructor, Factory, Abstract,
Prototype, Singleton and Builder.
Structural patterns are concerned with object composition and typically identify simple
ways to realize relationships between different objects. They help ensure that when one
part of a system changes, the entire structure of the system doesn't need to do the same. They also assist in recasting parts of the system which don't fit a particular purpose into those that do.
Patterns that fall under this category include: Decorator, Facade, Flyweight, Adapter
and Proxy.
Behavioral Design Patterns
Behavioral patterns focus on improving or streamlining the communication between
disparate objects in a system.
Some behavioral patterns include: Iterator, Mediator, Observer and Visitor.
Creational Based on the concept of creating an object.
Factory Method (Class)
This makes an instance of several derived classes based on interfaced data or events.
Abstract Factory (Object)
Creates an instance of several families of classes without detailing concrete classes.
Builder (Object)
Separates object construction from its representation, always creates the
same type of object.
Prototype (Object)
A fully initialized instance used for copying or cloning.
Singleton (Object)
A class with only a single instance with global access points.
Structural Based on the idea of building blocks of objects
Adapter (Class)
Match interfaces of different classes therefore classes can work together
despite incompatible interfaces
Adapter (Object)
Match interfaces of different classes therefore classes can work together
despite incompatible interfaces
Bridge (Object)
Separates an object's interface from its implementation so the two can
vary independently
Composite (Object)
A structure of simple and composite objects which makes the total object
more than just the sum of its parts.
Decorator (Object)
Dynamically add alternate processing to objects.
Facade (Object)
A single class that hides the complexity of an entire subsystem.
Flyweight (Object)
A fine-grained instance used for efficient sharing of information that is
contained elsewhere.
Proxy (Object)
A place holder object representing the true object Behavioral Based on the way objects play and work together.
Behavioral Based on the way objects play and work together.
Interpreter (Class)
A way to include language elements in an application to match the
grammar of the intended language.
Template Method (Class)
Creates the shell of an algorithm in a method, then defer the exact steps to a subclass.
Chain of Responsibility (Object)
A way of passing a request between a chain of objects to find the object
that can handle the request.
Command (Object)
Encapsulate a command request as an object to enable, logging and/or
queuing of requests, and provides error-handling for unhandled requests.
Iterator (Object)
Sequentially access the elements of a collection without knowing the
inner workings of the collection.
Mediator (Object)
Defines simplified communication between classes to prevent a group
of classes from referring explicitly to each other.
Memento (Object)
Capture an object's internal state to be able to restore it later.
Observer
A way of notifying change to a number of classes to ensure consistency
between the classes.
State (Object)
Alter an object's behavior when its state changes
Strategy (Object)
Encapsulates an algorithm inside a class separating the selection from
the implementation
Visitor (Object)
Adds a new operation to a class without changing the class
댓글 없음:
댓글 쓰기