Skip to content

Latest commit

History

173 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Design Patterns in Java

🌟 Introduction

This repository contains implementations of classic design patterns in Java, following object-oriented design principles. Each pattern includes:

  • Java implementation with clear example
  • Detailed explanation in its own README

🗂 Pattern Categories

Behavioral Patterns

Patterns that deal with object interaction and responsibility distribution.

PatternDescriptionImplementation
MementoImplementing the undo mechanismsView
stateAllowing an object to alter its behavior based on its internal stateView
IteratorAllowing access the elements of a collection without exposing its underlying representationView
StrategyEnables selecting an algorithm's behavior at runtimeView
Template MethodDefines the skeleton of an algorithm in a method, deferring some steps to subclassesView
CommandTurns a request into a stand-alone object containing all information about the requestView
ObserverDefines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automaticallyView
MediatorReduces chaotic dependencies between objects by restricting direct communications between them and forcing them to collaborate only via a mediator objectView
Chain of ResponsibilityAllows passing requests along a chain of handlersView
VisitorAllows adding new operations to existing object structures without modifying the structures themselvesView

Creational Patterns

Patterns that deal with object creation mechanisms.

PatternDescriptionImplementation
SingletonEnsures a class has only one instance and provides a global point of access to that instanceView
Factory MethodProvides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be createdView

🚧 Ongoing Development

This repository is under active development, with more design patterns being implemented regularly. Future updates will include additional creational, structural, and behavioral patterns, along with real-world examples, performance considerations, and comparisons between similar patterns. Contributions and suggestions are welcome—feel free to open an issue or submit a pull request! Stay tuned for more patterns like Interpreter, Chain of Responsibility, and Null Object, coming soon.

About

Object Oriented Design Patterns in Java

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages