This module introduced you to design patterns at a very high level.
You learned how design patterns make software development easier by providing you with a toolbox of solutions to common problems you encounter in object-oriented design.
Here are several ways in which the design patterns in this module can affect the way you design object-oriented software, based on our day-to-day experience with them.
Studies of expert programmers for conventional languages have shown that knowledge and experience is not organized simply around syntax but in larger conceptual structures such as
- algorithms,
- datastructures and
- idioms
and plans for fulfilling a particular goal. Designers probably do not think about the notation they are using for recording the design as much as they try to match the current design situation against plans, algorithms, data structures, and idioms they have learned in the past.
Computer scientists name and catalog algorithms and data structures, but they do not often name other kinds of patterns.
Design patterns provide a common vocabulary for designers to use to communicate, document,and explore design alternatives.
Design patterns make a system seem less complex by letting you talk about it at a
higher level ofabstraction than that of a design notation or programming language.
In addition, design patterns raise the level at which you design and enable you to discuss design with your co-workers. Once you have absorbed the design patterns discussed on this website, your design vocabulary will almost certainly change.
You will speak directly in terms of the names of the design patterns. Furthermore, you will find yourselfsaying things like, "Let us use Factory pattern for this situation" or, "Let us apply the"
Decorator pattern.
The process of decomposing a problem into small subproblems is the process of modularization.
Just like the complexities of getting from your home to Moscow can be modularized into a set of yes/no questions, any other complex problem also can be modularized. Figure 2-9 illustrates this process.
The next module explores the Singleton pattern, one of the simpler design patterns. You will learn how Singleton classes allow you to place restrictions on what client programmers are allowed to create.
The course project will be continued by writing a Singleton
class that manages the interaction of the different lights.
[1]divide-and-conquer:
In computer science, divide and conquer is an algorithm design paradigm based on multi-branched recursion. A divide-and-conquer algorithm works by recursively breaking down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined to give a solution to the original problem.