Introduction to Defining Design Patterns
In this module you explore how design patterns enhance traditional object-oriented programming techniques by allowing you to quickly solve common problems and communicate those solutions to other programmers.
In this module, you will learn:
What design patterns are:
Why you need design patterns?
How design patterns encourage code reuse and more maintainable code
The three basic kinds of design patterns
If a problem occurs over and over again and a solution to that problem has been used effectively, then
that solution is described as a pattern. The design patterns are language-independent strategies for solving common object-oriented design problems.
In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design.
A design pattern is a description or template for how to solve a problem that can be used in many different situations.
Each pattern describes a probem which 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.
Our solutions are expressed in terms of objects and interfaces instead of walls and doors, but at the core of both kinds of patterns is a solution to a problem in a context.
Our solutions are expressed in terms of objects
and interfaces instead of walls and doors, but at the core of both kinds of patterns
is a solution to a problem in a context.
For this site I have concentrated on patterns at a certain level of abstraction.
Design patterns are not about designs such as
- linked lists and
- hash tables
that can be encoded in classes and reused as is.
Design Patterns are not complex, domain-specific designs for an entire application or subsystem.
The design patterns on this site are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.
A design pattern names, abstracts, and identifies the key aspects of a common design structure
that make it useful for creating a reusable object-oriented design.
The design pattern
identifies the participating classes and instances, their roles and collaborations, and the distribution of responsibilities.
Each design pattern focuses on a particular object-oriented design problem or issue.
It describes when it applies, whether it can be applied in view of other design constraints, and the consequences and trade-offs of its use. Since we must eventually implement
our designs, a design pattern also provides sample C++ and Java code to illustrate an implementation.