Java Reference
In-Depth Information
introduction to patterns
The concept of the design pattern is well known in the area of software engineering. Many defini-
tions for “pattern” exist, but broadly speaking, a pattern is a general applicable and reusable solu-
tion that solves frequently occurring problems and architectural challenges in software design. In
other words, a pattern provides a description on how to solve a particular problem, which is appli-
cable in many situations.
Interestingly, the notion of a pattern did not originate in the realm of programming or software
engineering, but as an architectural concept. In 1977, Christopher Alexander put forth the idea of
capturing architectural design principles as reusable descriptions, formulated in his work, A Pattern
Language: Towns, Buildings, Construction . He stated that “each pattern describes a problem that
occurs over and over again in our environment and then describes the core of the solution to that
problem in such a way that you can use this solution a million times over without ever doing it the
same way twice.” Then, in 1987, Kent Beck and Ward Cunningham started experimenting with the
idea of applying patterns to programming and presented their results at object‐oriented software
engineering conferences. From that moment onward, software and programming “design patterns”
have been popular in computer science.
The big surge in interest, however, followed the publication of the topic Design Patterns: Elements
of Reusable Object‐Oriented Software in 1994 by Gamma, Helm, Johnson, and Vlissides, com-
monly referred to as the “Gang of Four.” The topic describes 23 design patterns for use in object‐
oriented software projects and has become highly influential in the field of software engineering. So
much so that it is incredibly hard to find a mid‐ to large‐scale Java, C++, Smalltalk, or other Object-
Oriented Programming language‐based project that doesn't contain one of these design patterns.
Remember that a pattern defines a concrete solution, meaning that you should be able to use a pat-
tern repeatedly once the reference is given, and the solution must be applicable in lots of different
situations. To describe and write down these patterns, many different forms have been proposed,
ranging from free‐form, narrative texts to structured forms containing well‐defined sections (the
Gang of Four books, for instance, applies a very structured form). In addition, a repository or
catalogue should also be structured in such a way that specific patterns can be easily and quickly
retrieved. To facilitate this, patterns are often structured in so‐called pattern languages or pattern
groups: a set of patterns aiming to solve the same general problem.
The “Gang of Four” book structures patterns as being Creational, Structural, or Behavioral.
Creational patterns deal with object creation mechanisms, as the basic form of object creation
could result in design problems or added complexity to the design. Structural patterns ease the
design by identifying a simple way to realize relationships between entities. Behavioral patterns
identify common communication patterns between objects to increase flexibility in carrying out this
communication.
object‐oriented patterns
This section takes you through a handful of the original Gang of Four design patterns. It's presented
in a relaxed style, where instead of providing the pattern in a very strict and structured form (you
can read the original book for that), you see how the pattern works, how you can spot it in real‐life
 
Search WWH ::




Custom Search