Q: What is a Design Pattern?
a: Design Patterns represent solutions to problems what arise when developing software within A Particular context.
Each pattern describes a problem which occurs over and over again in we environment, and then describes the core of the S Olution to so problem, in such a-on-the-same-the-solution a million times over, without ever doing it the same The twice.
C. Alexander,
The Timeless to Building, 1979Patterns help you learn from other ' s successes, instead of your own failures.
Mark Johnson(Cited by Bruce Eckel)
Q: How many types of design patterns exist?
A: Basically, there is three categories:
- creational Patterns: Deal with initializing and configuring classes and objects
- Structural Patterns: Deal with decoupling the interface and implementation of classes and objects
- Behavioral Patterns: deal with dynamic interactions among societies of classes and objects
Q: What is good books about design patterns.
A: Here is some must-have books:
- Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, John vlissides (also known as Gang of four)
- Thinking in Patterns with Java, by Bruce Eckel
- Thinking in Patterns with C + +, by Bruce Eckel
Q: How can I quickly find information about a design pattern?
A: Here is some links on the Web:
General
creational Patterns
- Abstract Factory: Creates an instance of several families of classes
- Builder: Separates object construction from its representation
- Factory Method: Creates an instance of several derived classes
- Resource 1
- Resource 2
- Resource 3
- Prototype: A fully initialized instance to be copied or cloned
- Singleton: A class of which only a single instance can exist
Structural Patterns
- Adapter: Match Interfaces of different classes
- Resource 1
- Resource 2
- Resource 1
- Bridge: Separates an object ' s interface from its implementation
- Composite: A tree structure of simple and Composite objects
- Resource 1
- Resource 2
- Resource 3
- Decorator: Add responsibilities to objects dynamically
- Resource 1
- Resource 2
- Resource 3
- Façade: A single class, represents an entire subsystem
- Flyweight: A fine-grained instance used for efficient sharing
- Resource 1
- Resource 2
- Resource 3
- Proxy: An object representing another object
Behavioral Patterns
- Chain of Responsibility: A-by-passing a request between a Chain of objects
- command: Encapsulate a command request as an object
- Resource 1
- Resource 2
- Resource 3
- interpreter: A-to-include language elements in A program
- Iterator: Sequentially access the elements of a collection
- Mediator: Defines simplified communication between classes
- Memento: Capture and restore an object ' s internal state
- Observer: A-A-notifying change to a number of classes
- Resource 1
- Resource 2
- Resource 3
- State: Alter A object ' s behavior when it state changes
- Resource 1
- Resource 2
- Resource 3
- Strategy: Encapsulates an algorithm inside a class
- Resource 1
- Resource 2
- Resource 3
- Template Method: Defer The exact steps of an algorithm to a subclass
- Resource 1
- Resource 2
- Resource 3
- Visitor: Defines a new operation to a class without change
- Resource 1
- Resource 2
- Resource 3
and more resources on (www.oodesign.com). Make sure you read the design principles, it's very usefull for understanding the desing patterns:
OO Design principles:
Open Close Principle
Dependency inversion Principle
Interface sergregation Principle
Single Responsibility Principle
Liskov ' s Substitution Principle
Creational Patterns:
Singleton
Factory
Factory Method
Abstract Factory
Builder
Prototype
Object Pool
Behavioral Patterns:
Chain of Responsibility
Command
Interpreter
Iterator
Strategy
Template Method
Visitor
C + + Design Pattern:what is a design Pattern?