Skip to content

YousefBZo/Design-Patterns

Repository files navigation

Software Design Patterns Collection

A curated repository demonstrating the practical implementation of core Software Design Patterns (Creational, Structural, and Behavioral) in object-oriented programming (OOP). This repository serves as a technical reference for building scalable, decoupled, and highly maintainable software architectures with strict adherence to SOLID principles and Clean Code standards.

🧠 Architectural Overview

Design patterns are reusable solutions to common software design problems. Rather than focusing on syntax, this repository showcases the structural blueprints required to avoid spaghetti code and enforce strict object-oriented design paradigms.

🛠️ Tech Stack & Concepts

  • Language: Java (Strongly typed OOP environment)
  • Principles Applied: SOLID (SRP, OCP, LSP, ISP, DIP), High Cohesion, Loose Coupling.
  • Reference Material: "Design Patterns: Elements of Reusable Object-Oriented Software" by the Gang of Four (GoF).

📂 Catalog of Implemented Patterns

1. Creational Patterns (Object Creation Mechanisms)

Focuses on handling object creation mechanisms in a optimized way, decoupling the system from how its objects are created and composed.

  • Singleton: Ensuring a class has only one instance while providing a global access point to it.
  • Factory Method: Providing an interface for creating objects in a superclass, but allowing subclasses to alter the type of objects that will be created.
  • Abstract Factory: Producing families of related objects without specifying their concrete classes.
  • Builder: Constructing complex objects step-by-step, allowing the separation of construction logic from the final representation.

2. Structural Patterns (Class & Object Composition)

Focuses on how classes and objects can be composed to form larger, efficient, and flexible structures.

  • Adapter: Allowing objects with incompatible interfaces to collaborate seamlessly.
  • Facade: Providing a simplified interface to a complex library, desktop, or subsystem of classes.
  • Decorator: Attaching new behaviors to objects dynamically by placing them inside special wrapper objects.
  • Proxy: Providing a substitute or placeholder for another object to control access to it.

3. Behavioral Patterns (Object Communication & Responsibilities)

Focuses on algorithms and the assignment of responsibilities between communicating objects.

  • Strategy: Defining a family of algorithms, putting each of them into a separate class, and making their objects interchangeable.
  • Observer: Defining a subscription mechanism to notify multiple objects about any events that happen to the object they’re observing.
  • Command: Turning a request into a stand-alone object that contains all information about the request.
  • State: Allowing an object to alter its behavior when its internal state changes.

🧼 SOLID Principles Mapping

Every pattern implemented in this repository is designed to honor the core software engineering pillars:

  • Open/Closed Principle (OCP): Code is open for extension but closed for modification through interface-driven design.
  • Dependency Inversion (DIP): High-level modules do not depend on low-level modules; both depend on abstractions (interfaces).

🚀 How to Navigate this Repository

  1. Browse through the pattern categories inside the source folders.
  2. Each pattern includes a concrete example mimicking a real-world scenario (e.g., Payment Gateways using Strategy, Notifications using Observer).
  3. Read the inline code comments explaining why a specific abstraction or composition was chosen.

About

A curated collection of core Software Design Patterns (Creational, Structural, and Behavioral) implemented with strict adherence to OOP paradigms and SOLID principles.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages