![]() |
|
|
|
What is design a pattern? A design pattern is the abstract structure of a common solution to a common problem in object-oriented programming. It abstracts something to do from existing data structures, algorithms, code , classes and objects that does it. So the common purpose of design patterns is to make objects and classes reusable and extensible. Design patterns are a means to communicate, identify, and remember solutions to common problems. It names, explains and evaluates a solution to a common probelm. Each pattern has four essential elements, the pattern's name, the problem it solves, the solution to the problem and the consequences of that solution. There are three types of design patterns (1) Creational patterns (2) Structural patterns and (3) Behavioral patterns. Creational patterns are used to create objects of the right class of a problem. It is helpful when using polymorphism and there is a need to choose between different classes at runtime rather than at compile time. Structural patterns form larger structures from individual classes. Behavioral patterns describe interactions between objects. Patterns also can be divided based on their scope. Object patterns deal with the relationship between objects. It allows instances of different classes to be used in the same place in a pattern, avoids fixing the class that accomplished a given task at compile time rather than at runtime, and uses object composition to establish relationships between objects. Class patterns deal with the relationship between classes and their subclasses. It uses inheritance to establish relationships and generally fixes the relationships at compile time. So it is less flexible and dynamic than object patterns. The design patterns themselves follow a pattern. Each pattern has
What is a Design Pattern? |
| About Us | Contact Us | Disclaimer | Privacy Policy | ©2008 thewebguru.com |