Thursday, December 27, 2007

Design Patterns

Creational:

Abstract Factory: Creates concrete instances of classes.

Singleton:
Creates a single instance of a class and ensures there is only one instance in the system.
Class contruction: Keep a private member in the class and let the constructor initialize it only if that member is null.
Application: System resources; there is only one printer in the system and we must access it thru singleton pattern.

Structural:

Facade: Represents an entire system of subclasses.

Proxy: Not the real object itself, just represents the real object.

Behavioral:

Command:
A command request is encapsulated as an object.

Observer:
Notifies changes to classes.
Application: Error logging.

Web Design specific:

MVC (Model-View-Controller):

Complete separation of the;
model (database),
view (page view) and
controller (business logic).