Design Patterns
Why design patterns ?
Design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved.
The design patterns are language-independent strategies for solving common object-oriented design problems.
Design Principal:
1. Identify the aspects of the application that vary and separate them from what stays the same.
2. Program to interface not an implementation.
3. Favor composition over inheritance.
When not to use patterns ?
While using a pattern properly results in reusable code, the consequences often include some costs as well as benefits. Reusability is often obtained by introducing encapsulation, or indirection, which can decrease performance and increase complexity.
Types of Design Patterns:
Creational Patterns
Structural Patterns
Behavioral Patterns
Architectural Design Patterns
Design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved.
The design patterns are language-independent strategies for solving common object-oriented design problems.
Design Principal:
1. Identify the aspects of the application that vary and separate them from what stays the same.
2. Program to interface not an implementation.
3. Favor composition over inheritance.
When not to use patterns ?
While using a pattern properly results in reusable code, the consequences often include some costs as well as benefits. Reusability is often obtained by introducing encapsulation, or indirection, which can decrease performance and increase complexity.
Types of Design Patterns:
Creational Patterns
Structural Patterns
Behavioral Patterns
Architectural Design Patterns