|
Patterns act as building
blocks for constructing more complex designs,
employing predefined artifacts explains
Dr R Srinivasan
IT is very common and natural
that in any branch f engineering, when the experienced
people work on a particular problem, it is very
unusual for them to tackle it by inventing a new
solution, which is completely distinct from existing
ones. Their practice will be to examine whether
a similar problem was solved earlier and then
reuse the important aspects of its solution to
solve the new problem. This phenomenon and practice
is what we described as "Patterns".
The Gang of Four, Eric Gamma, et. al., were the
first to talk about patterns in the design of
software development and they illustrate the same
point that, "one thing expert designers know
"not" to do is solving every problem
from first principles. Rather, they reuse solutions
that have worked for them in the past. When they
find a good solution, they employ it again and
again".
In a nutshell, patterns help
the designers to build on the collective experience
of skilled software engineers in such a way that
it deals with a specific, recurring problem in
design or implementation of a software system.
Instead of the knowledge remaining only in the
heads of few experts, Patterns make it more generally
available to the designers in future. By its characteristic,
Patterns provide a common vocabulary and understanding
in design. In an earlier article, I had stressed
upon the importance of deciding the proper architecture
before going to the design aspects in software
development. Here also Patterns help as a means
of documenting Software Architecture and illustrate
the vision of the software architect. By adopting
this method, it is very easy to extent and modify
either the original architecture or the system's
code. Another property is that Patterns support
the construction of software with defined properties,
viz., to provide a skeleton of functional behavior
and then implement the functionality of the specific
application. Moreover, Patterns will help in maintaining
consistency between co-operating components and
provide transparent peer-to-peer inter-processor
communication. Patterns also address non-functional
requirements like reliability, testability, reusability
and changeability. By providing a predefined set
of components, roles and relationships between
them, Patterns specify particular aspects of concrete
software architectures. GOF say that Patterns
act as building blocks for constructing more complex
designs and this method of employing predefined
design artifacts helps in faster and reliable
design. Inspite of all these attributes to Patterns-based-design,
it should be borne in mind that Patterns provide
only a method for generic solution rather than
a prefabricated module - Patterns help in solving
problems but do not provide complete solution.
Every Pattern is represented
by a three part schema. They are context, the
problem and the solution. Context provides the
design situation leading to the design problem,
which in turn describes a set of forces repeatedly
arising under the context. The solution comes
out with the configuration to balance the forces.
Patterns vary in different ranges of scales and
abstraction. Among the categories of Patterns,
some of them help in structuring a software system
and the constituent subsystems, some of them help
in refining the subsystems defining the components
therein and stating the relationships among them,
and some help in implementing a particular design.
Patterns can also be grouped as Architectural
Patterns, Design Patterns and Idioms.
In his paper on "AntiPatterns,
refactoring Software, Architectures, and Projects
in Crisis", Hays McCormick says that the
emergence of Design Patterns has provided the
most effective form of software guidance. The
whole patterns movement has gone a long way in
codifying a concise terminology for conveying
sophisticated computer science thinking. To describe
in a generic way, Design Pattern is a general
solution to a frequently occurring design problem,
often increasing the flexibility of the architecture
of The system. Design Patterns help in choosing
design alternatives that make a system reusable
and avoid alternatives that compromise reusability.
Design Patterns provide a common sense perspective
that allows software developers and project managers
to make and justify correct decisions. The main
reasons for motivation in adopting Design Patterns
in Software Engineering are: availability of beneficial
solutions reached in earlier contexts which may
be general or application-dependent, characteristic
of Design Pattern being the explicit higher-level
structure which is not directly supported by a
specific programming language and also the ability
to use in documentation so that it will be useful
for developers in future. Most large Object Oriented
Systems use Design Patterns. Design Patterns show
how to use primitive techniques such as objects,
inheritance and polymorphism. They show how to
parameterize a system with an algorithm, a behavior,
a state, or the kind of objects they create (GOF).
To conclude, Design Patterns illustrate a methodology
to describe more of the "why" of a design
and not just record the result of the decisions.
(To be continued)
(The
author is Chief Technology Officer, Internet Component
Management Group, Bangalore and can be contacted
at: r.srinivasan@iCMGworld.com)
|