Design Patterns Exposition Conclusion
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.
The most common design patterns
are divided into
- creational patterns that describe how objects are created;
- structural patterns that describe how objects and classes are combined into larger composite structures, and
- behavioral patterns that describe how objects and classes interact.
Let us break this down in simpler terms. Imagine design patterns as tools in a toolbox that you have gotten really familiar with from using them every day. Think about when you're trying to solve a problem. You don't just think in terms of the basic steps or the language you're using, right? Instead, you pull from bigger ideas like certain ways to organize data, specific methods to get things done, or common strategies that you've seen work before. It's like chefs having their favorite recipes, they don’t always think about every little ingredient; they just know the dish's name and the core idea behind it. Now, while computer experts have cool names for algorithms and ways to store data, they aren't great at naming some other patterns they use. That's where design patterns shine! They give everyone a shared language. Instead of describing every little detail of a system, you can just use the name of a design pattern, and bam! Your colleagues will get you.
This not only makes talking about designs easier but also lifts the conversation. It's like discussing movie plots instead of explaining every scene. After spending time with the patterns on this site, you'll notice a shift in how you talk about designs. You won't be getting lost in the weeds; you'll be calling out design patterns by name, making everything clearer and more engaging.
Human problems are addressed by computer programs. Using a technique known as dynamic programming, one can divide more complex issues into smaller ones. The strategy is to handle each minor issue separately before combining them all into a single, more comprehensive solution.
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 can also be modularized.
In looking at modularization, you may be thinking that it does not look too difficult and you would be absolutely right.
The more complex the problem, the more it makes sense to modularize it. Therefore, the initial reasoning in OOP programming, far from being complex, simplifies the complex. Even the most daunting programming problem can be solved by this divide-and-conquer
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
class that manages the interaction of the different lights.
Gang of Four Patterns
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.