Okay.. So the whole of software industry preaches everyone to work on reusability. We have always been asked to develop reusable code and use it later. The most famous keys Ctrl+C and Ctrl V is designed for reusability. Now the reason why I am talking about reusability is because, Design Patterns just do that. Here it’s not the code we resuse, it’s the solution to the most commonly occurring problem we reuse.
One thing to note is, Design Patterns cannot be directly transformed into code. It just helps you in making a design decision. Because every problem is different in different contexts, the dogma of one solution fits all doesn’t work here. It sort of gives you a manual or a generic solution on what are best ways of approaching the problem.
Finally its all with your experience, you can make the best design decision. So we have three kinds of Design Patterns :
Creational Design Patterns - It is all about Class Instantiation.
As the name goes, it’s about the best ways to create classes and objects. There are two types in them – Class creation patterns and Object creation patterns. For class creation, these patterns use inheritance for the instantiation while for object creation, they use delegation to get their job done.
Structural Design Patterns - It’s all about Class composition
As self-explanatory it is about structuring the objects and classes. Structural Class Patterns use inheritance to compose interfaces and Structural Object Patterns defines the way to compose objects.
Behavioral Design Patterns - It’s all about Class’s Object Communication
These patterns talk about how objects can communicate with each other.
In next couple of blogs I plan to take one design pattern at a time and make my observations.
No comments:
Post a Comment