A pattern is a general reusable solution to a commonly occurring problem. Different types of patterns in software engineering include Architectural Patterns, Design Patterns, Idioms etc.
Architectural patterns specify the system-wide structural properties of an application, and have an impact on architecture of its subsystems. The Model-View-Controller pattern is one of the best-known examples of an architectural pattern.
Design patterns are medium-scale patterns that focusses on subsystems or components of the overall software architecture, or the relationships between them. Like architectural patterns, design patterns are also programming language agnostic. Examples include GoF Patterns, GRASP Patterns etc.
Idioms are mostly programming language specific patterns. Examples include wait-loop idiom in Java, double loop idiom and holder idiom for implementing singleton pattern in Java etc.
Benefits of Patterns
-
Consider that someone had a architecture or design problem and found a solution. They document it as a pattern so others can reuse them. Thus patterns help us in solving design problems faster.
-
Patterns also give a shared name for a problem-solution combo. You can use this name in various design discussions to refer to this problem-solution combo. This helps you to maximize the value of your communication by conveying more relavant information with less words.
Effectively Using Patterns
Effectively using a design pattern involves understanding its name, type, intent, alternate names, use, examples, structure (through diagrams), participants (and their roles), interactions of participants, consequences (or side effects), implementation details and even it comparisons with any related patterns.
You should also keep in mind certain consequences of using design patterns:
-
As reusability is often obtained by introducing encapsulation or delegations, the design may affect the performance and may also increase overall complexity.
-
There is a tendency to learn few patterns and try to force all design problems or code into those patterns. By forcing a problem or code into a design pattern wrongly may also create further problems.
Object Oriented Design Principles
All design patterns are based on one or more of the Object Oriented Design principles. Having thorough understanding of the design principles will help you understand the design patterns better and faster, and will even help you solve many design scenarios if you can't find a design pattern fitting that scenario. So learn design principles first, followed by patterns, to be a good designer faster.
UML Diagrams
A picture can speak thousand words. UML diagrams are those pictures which can speak all those words about your design.
There are many categories of UML diagrams. Most important ones for your object oriented design are the class diagrams.
- heartin's blog
- Log in or register to post comments
Recent comments