Part 1 - Introduction
Part 1 - Introduction
Part 1 - Introduction
NET
Part 1 - Introduction
The concept of a ‘Software Design Pattern’ was adopted from the idea of a building
design pattern in the field of building design and architecture. For more information, refer
to the book ‘The Timeless Way of Building by Christopher Alexander’. Within the
context of software engineering, a Design Pattern is the official term given to a design
concept that encompasses the idea of reuse and communication. Simply stated, Design
Patterns are tried and tested solutions to common and recurring challenges. At their core,
design patterns are the manifestation of good object-oriented design principles.
• Once a design pattern has emerged to solve a particular problem, that design
pattern can be applied countless times on future tasks where a similar problem
may arise. It can also be used by countless others who may encounter similar
problems.
• Design patterns allow one to refer to a design concept without explaining the full
detail of that concept. How often has one heard a conversation along the lines of
the following?
Developer A: “Remember that thingy we used last time to solve a problem similar to this
one.”
Developer A: “That thingy where we allowed only a single instance of an object to exist
at any given time”
Team: “Heh!?”
Imagine the development team has reached a certain level of maturity in terms of design
thinking and design patterns. The conversation would instead sound something like this.
Team: “A Singleton will work. And we could use a Façade for the Products sub-system.”
As one can see, a Design Pattern speaks a thousand words. It is also far more professional
and efficient to speak of well documented concepts than a ‘thingy’.
This allows one to think of the larger design in terms of smaller component areas.
Therefore, when one looks at the bigger picture, one can visualize it in terms of its
constituent parts.
The GOF book catalogued 23 design patterns into 3 groups, namely Creational, Structural
and Behavioural. I have adopted the intent of the design patterns as per the GOF book.
Creational
Abstract Factory Provide an interface for creating families of related or
dependent objects without specifying their concrete
classes.
Singleton Ensure a class only has one instance, and provide a global
point of access to it.
Structural
Adapter Convert the interface of a class into another interface
clients expect. Adapter lets classes work together that
couldn't otherwise because of incompatible interfaces.
Behavioural
Chain Of Responsibility Avoid coupling the sender of a request to its receiver by
giving more than one object a chance to handle the
request. Chain the receiving objects and pass the request
along the chain until an object handles it.