Introduction to Design Patterns
Posted by Tihomir Ivanov on 23 October 2008 10:33
Rating: 0.00
Design patterns were introduced in Erich Gamma, Richard Helm, Ralph Johnson,
and John Vlissides’s seminal work Design Patterns: Elements of Reusable Object-
Oriented Software (Addison-Wesley).
There are only 23 classic patterns, and a good programmer can learn
the names and uses of all of them with some practice.
These core patterns address issues in mainline object-oriented programming (OOP),
and the original implementations were presented in C++ and Smalltalk (the primary
OOP languages at the time they were developed). Since then, other books have
implemented the patterns in Java, Visual Basic, and C#. As the value of the pattern
concept has become accepted, new patterns have been proposed to add to the
original list. In addition, there are now patterns that are applicable to specific areas,
such as software architecture, user interfaces, concurrency, and security. Although
these patterns are extremely important in their areas, their adherents are fragmented,
and the core set of universally accepted patterns has not been expanded.
The 23 patterns are divided into three groups: creational, structural, and behavioral.
Creational Patterns
The creational patterns aim to separate a system from how its objects are created,
composed, and represented. They increase the system’s flexibility in terms of the
what, who, how, and when of object creation. Creational patterns encapsulate the
knowledge about which classes a system uses, but they hide the details of how the
instances of these classes are created and put together. Programmers have come to
realize that composing systems with inheritance makes those systems too rigid. The
creational patterns are designed to break this close coupling.
Structural Patterns
Structural patterns can be employed while a system is being designed, or later on
during maintenance and extension. In fact, some of them are specifically useful in the
post-production stages of the lifecycle of a software system, when changes are introduced
that were not foreseen and when even the interfaces between components
need updating. Thus, sometimes when you want to add functionality, you will be
working with existing classes that cannot be changed.
Behavioral Patterns
Behavioral patterns are concerned with algorithms and communication between
them. The operations that make up a single algorithm might be split up between different
classes, making a complex arrangement that is difficult to manage and maintain.
The behavioral patterns capture ways of expressing the division of operations
between classes and optimize how the communication should be handled.
Comments:
No comments yet.