Design patterns are reusable solutions to common problems in software engineering. They are a way of capturing and documenting the best practices and experiences of software developers, and providing a common vocabulary and framework for discussing and solving design problems.
The most commonly used software design patterns in real world projects are:
- Singleton pattern - used to ensure that only one instance of a class is created and shared among different parts of the application.
- Factory pattern - used to create objects without specifying the exact class of object that will be created.
- Observer pattern - used to allow one or more objects to be notified when a state change occurs in another object.
- Decorator pattern - used to add additional functionality to an existing object without changing its structure.
- Strategy pattern - used to allow an algorithm to be selected and applied at runtime.
- Template method pattern - used to define the steps of an algorithm and allow subclasses to provide the implementation for one or more of those steps.
- Command pattern - used to encapsulate a request as an object and allow the request to be executed at a later time.
- Adapter pattern - used to allow two incompatible classes to work together by providing a standard interface for the adapted class.
- Facade pattern - used to provide a simplified interface to a complex system.
- Builder pattern - used to construct complex objects step by step.