Skip to content

This repository hosts a collection of classic design patterns implemented in Java programming languages.

Notifications You must be signed in to change notification settings

DhirajGadekar/Design-Patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

Design-Patterns

Design patterns are general reusable solutions to common problems that occur during software design and development. They represent best practices evolved over time by experienced software developers.These patterns provide templates or guidelines for solving problems in a particular context. They aren't code or libraries, but rather descriptions or templates on how to solve a problem that can be applied in various situations.

Design patterns can be categorized into three main types: creational, structural, and behavioral patterns. Here's an overview of each type:

1. Creational Patterns:

These patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. They help in creating objects in a system while hiding the complexities involved in the creation process. Some common creational patterns include:

  1. Singleton Pattern: Ensures a class has only one instance and provides a global point of access to it.
  2. Factory Method Pattern: Defines an interface for creating an object but lets subclasses decide which class to instantiate.
  3. Abstract Factory Pattern: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.
  4. Builder Pattern: Separates the construction of a complex object from its representation, allowing the same construction process to create various representations.
  5. Prototype Pattern: Creates new objects by copying an existing object, known as the prototype.

2. Structural Patterns:

These patterns focus on class composition and object composition. They deal with the composition of classes or objects to form larger structures. Some examples include:

  1. Adapter Pattern: Allows incompatible interfaces to work together by creating a bridge between them.
  2. Decorator Pattern: Adds behavior to objects dynamically without altering their structure.
  3. Facade Pattern: Provides a simplified interface to a complex system, making it easier to use.
  4. Bridge Pattern: Decouples an abstraction from its implementation so that they can vary independently.
  5. Composite Pattern: Composes objects into tree structures to represent part-whole hierarchies. Clients can treat individual objects and compositions of objects uniformly.

3. Behavioral Patterns:

These patterns concentrate on communication between objects, how they interact, and responsibilities among them. They're concerned with the interaction and responsibility of objects. Examples include:

  1. Observer Pattern: Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
  2. Strategy Pattern: Defines a family of algorithms, encapsulates each one, and makes them interchangeable.
  3. Command Pattern: Encapsulates a request as an object, thereby allowing for parameterization of clients with queues, requests, and operations.
  4. Chain of Responsibility Pattern: Passes a request along a chain of handlers, each processing the request or passing it to the next handler in the chain.
  5. State Pattern: Allows an object to alter its behavior when its internal state changes.

Types :

Creational Structural Behavioral
1. Singleton Design Pattern
2. Factory Design Pattern

Contributor :

Dhiraj Gadekar
Dhiraj Gadekar

Contributions are welcome! If you have any suggestions, improvements, or additional examples related to the Singleton pattern, feel free to open an issue or submit a pull request.

Feedback

If you have any feedback, please reach out to us at Email

About

This repository hosts a collection of classic design patterns implemented in Java programming languages.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages