Design Patterns
Prerequisites: Inheritance, Polymorphism
A design pattern is a named, reusable solution to a recurring design problem. One of the most common in Python:
class DatabaseConnection:
_instance = None
@classmethod
def get_instance(cls):
if cls._instance is None:
cls._instance = cls()
return cls._instance
This is the Singleton pattern — guaranteeing only one instance of a class ever exists (useful for something like a single shared database connection). Patterns are a shared vocabulary between developers, not a checklist to force into every project.