top of page

Common Design Patterns

Common Design Patterns


Design patterns are reusable solutions to common problems that arise during software design and development. They help promote best practices, improve code readability, and enhance the overall architecture of software systems. Here are some common design patterns:


1. Creational Patterns:

- Singleton: Ensures a class has only one instance and provides a global point of access to that instance.

- Factory Method: Creates objects without specifying the exact class of object that will be created.

- Abstract Factory: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.

- Builder: Separates the construction of a complex object from its representation, allowing the same construction process to create different representations.

- Prototype: Creates new objects by copying an existing object's properties and then modifying them as needed.


2. Structural Patterns:

- Adapter: Allows objects with incompatible interfaces to work together by providing a wrapper that translates one interface into another.

- Bridge: Decouples an abstraction from its implementation, allowing both to evolve independently.

- Composite: Composes objects into tree structures to represent part-whole hierarchies. It lets clients treat individual objects and compositions of objects uniformly.

- Decorator: Attaches additional responsibilities to an object dynamically without altering its structure.

- Facade: Provides a simplified interface to a complex system of classes, making it easier to interact with the system.


3. Behavioral Patterns:

- Observer: Defines a dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

- Strategy: Defines a family of algorithms, encapsulates each algorithm, and makes them interchangeable. Clients can choose an algorithm from the family to use.

- Command: Turns a request into a stand-alone object, encapsulating all information about the request. This allows parameterization of clients with different requests, queuing of requests, and logging of requests.

- State: Allows an object to change its behavior when its internal state changes.

- Chain of Responsibility: Avoids coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.


4. Architectural Patterns:

- MVC (Model-View-Controller): Separates an application into three interconnected components – the model (data and logic), the view (presentation), and the controller (handles user input and updates the model).

- MVVM (Model-View-ViewModel): Similar to MVC, but the ViewModel manages the data presentation and user interactions, often used in modern UI frameworks.



Related Posts

How to become a graphic designer

How to become a graphic designer? Becoming a graphic designer involves learning both design principles and mastering the tools used in...

bottom of page