Software design principles represent a set of guidelines that helps us to avoid having a bad design. There are 3 important characteristics of a bad design that should be avoided:
Rigidity – It is hard to change because every change affects too many other parts of the system.
Fragility – When you make a change, unexpected parts of the system break.
Immobility – It is hard to reuse in another application because it cannot be disentangled from the current application.
Open Close Principle
Software entities like classes, modules and functions should be open for extension but closed for modifications.
OPC is a generic principle. You can consider it when writing your classes to make sure that when you need to extend their behavior you don�t have to change the class but to extend it. The same principle can be applied for modules, packages, libraries. If you have a library containing a set of classes there are many reasons for which you�ll prefer to extend it without changing the code that was already written (backward compatibility, regression testing, �). This is why we have to make sure our modules follow Open Closed Principle.
When referring to the classes Open Close Principle can be ensured by use of Abstract Classes and concrete classes for implementing their behavior. This will enforce having Concrete Classes extending Abstract Classes instead of changing them. Some particular cases of this are Template Pattern and Strategy Pattern.
May be design patterns has three types as following
1. Creational Design Patterns:
A. Singleton Pattern
B. Factory Pattern
C. Factory Method Pattern
D. Abstract Factory
2. Behavioral Design Patterns:
A. Observer Pattern
B. Chain of Responsibility
C. Command Pattern
3. Structural Design Patterns:
A. Adapter Pattern
B. Bridge Pattern
C. Composite Pattern
D. Decorator Pattern
E. Proxy Pattern
I will have continue…………..this Article……………..