Introduction to Design Patterns
It is very often that, when designing software, that a large portion of the software we need to develop is something quite common which has been done before, again and again. Design Patterns are standardized best practice "template solutions" for common programming problems. They allow us to simply apply a "cookie cutter" approach to software design, allowing us the peace of mind that when we apply one of the many design patterns, that we are solving the particular design problem in a tried and tested way.
Design Patterns are typically categorized into one of the following broad categories:
- Creational Patterns: Design Patterns concerning object creation.
- Structural Patterns: Design Patterns concerned with the composition and structure of objects.
- Behavioral Patterns: Design Patterns which characterize the way in which objects interact and distribute responsibility.
Each Design Pattern is defined in terms of the following four componenets:
- Pattern Name: The name of the design pattern.
- Problem Statement: A description of the problem which the pattern provides a solution for.
- Solution: A description of the elements, relationships, behaviors and interactions which provides a solution to the problem statement.
- Consequences: The results and trade-offs of utilizing the design pattern.
In this module, we will not be covering all design patterns, but rather, we will cover a few patterns per category, showing how to implement them in Python. The intention is to get the learner familiar with using Design Patterns, so that the learner can lookup other design patterns and be able to utilize them on their own in their projects.