https://github.com/ashfaqbs/design-pattern
curated collection of Java-based design patterns with clear explanations, real-world use cases, and clean implementations. Covers creational, structural, and behavioral patterns with a focus on clarity, modularity, and relevance to modern system design.
https://github.com/ashfaqbs/design-pattern
design-patterns singelton-pattern
Last synced: 12 months ago
JSON representation
curated collection of Java-based design patterns with clear explanations, real-world use cases, and clean implementations. Covers creational, structural, and behavioral patterns with a focus on clarity, modularity, and relevance to modern system design.
- Host: GitHub
- URL: https://github.com/ashfaqbs/design-pattern
- Owner: Ashfaqbs
- Created: 2024-11-23T15:49:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-30T06:20:39.000Z (12 months ago)
- Last Synced: 2025-06-30T07:27:49.898Z (12 months ago)
- Topics: design-patterns, singelton-pattern
- Language: Java
- Homepage:
- Size: 899 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Design patterns are reusable solutions to common software design problems. In Java, they are categorized broadly into three main types:
1. **Creational Design Patterns**
Focus: Object creation mechanisms to create objects in a way that is suitable for the situation.
- Help make the system independent of how objects are created, composed, and represented.
- Key idea: **Control object creation to ensure flexibility and reuse.**
**Examples:**
- Singleton
- Factory Method
- Abstract Factory
- Builder
- Prototype
2. **Structural Design Patterns**
Focus: Class and object composition to form larger structures.
- Help ensure that different parts of a system work together in a flexible and efficient way.
- Key idea: **Simplify relationships between objects or combine them for new functionality.**
**Examples:**
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
3. **Behavioral Design Patterns**
Focus: Interaction and communication between objects.
- Help define how objects interact, how responsibilities are distributed, and how workflows are controlled.
- Key idea: **Streamline complex communication between objects.**
**Examples:**
- Chain of Responsibility
- Command
- Interpreter
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
### Quick Analogy for Understanding Types
1. **Creational Patterns:** Think of building a house. You decide how to construct it: blueprint (Prototype), modular pieces (Builder), or hiring a factory (Factory Method).
2. **Structural Patterns:** Consider how you connect rooms: walls (Adapter), open spaces (Bridge), or fancy decorations (Decorator).
3. **Behavioral Patterns:** It’s about how people in the house interact: assigning tasks (Command), following workflows (Template Method), or broadcasting news (Observer).