Version: 1.0.0
Date: September 28, 2025
This repository is for learning and implementing software design patterns concepts.
https://github.com/jadogeri/Design_Patterns_Java.git
![]() |
![]() |
|---|
- 7. References
- Utilize code snippet in larger project.
- Implement SOLID principles to promote clean code.
- Junior or Senior backend developers.
- Beginners learning (Java) and design patterns in software engineering.
- Programming Languages: Java
- IDE: IntelliJ and Visual Studio Code (VSCode)
- Plugins: Early AI, Google AI
- Version Control: Git and GitHub
- Code Analsis: SonarQube
- Singleton: Implement a class with a private constructor, a static instance, and a static getInstance() method to ensure only one instance exists.
- Factory Method: Define an interface or abstract class for products and concrete product implementations. Create a factory interface/abstract class and concrete factories to create product objects.
- Builder: Create a separate builder class to construct complex objects step-by-step, allowing for flexible object creation.
- Adapter: Create an adapter class that allows incompatible interfaces to work together by converting the interface of one class into another.
- Decorator: Use concrete decorator classes to add new responsibilities to objects dynamically without modifying their core structure.
- Facade: The primary class, subsystems the facade interacts with and a client component or application that uses the facade to access the subsystem's.
- Strategy: Define an interface for a family of algorithms, encapsulate each algorithm in a separate class, and allow clients to choose the desired algorithm at runtime.
- Observer: Implement a subject (publisher) and observer (subscriber) interface. The subject maintains a list of observers and notifies them of state changes.
- Command: Create Command objects (e.g., TurnOnLightCommand) to encapsulate requests, executed by a RemoteControl.
- Tutorialspoint : Design Patterns in Java.
- ForrestKnight : 7 Design Patterns EVERY Developer Should Know.
- CodingShuttle : 10 Essential Java Design Patterns Every Developer Should Master (With Code Examples).
- Tpointtech : Design Patterns in Software Engineering).
The purpose of this project is to learn and apply software design patterns principles in java applications.
This project will allow users to :
A Java project can be structured to demonstrate various design pattern implementations. This involves organizing code into packages and classes that exemplify the principles and structures of different patterns. Project Structure: A common approach is to create a top-level package for the project, such as com.example.designpatterns. Within this, sub-packages can be created for each category of design patterns (Creational, Structural, Behavioral) and further sub-packages for individual patterns.
design-patterns
└── src/main/java
├── creational
│ ├── singleton
│ │ ├── Connection.java
│ │ ├── DatabaseClient.java
│ │ ├── MySql.java
│ │ ├── Oracle.java
│ │ ├── MongoDB.java
│ │ ├── PostgresSql.java
│ │ └── SingletonRunner.java
│ ├── factory
│ │ ├── Game.java
│ │ ├── GameFactory.java
│ │ ├── PlayStation.java
│ │ ├── Nintendo.java
│ │ ├── Xbox.java
│ │ ├── PlayStationFactory.java
│ │ ├── NintendoFactory.java
│ │ ├── XboxFactory.java
│ │ └── FactoryRunner.java
│ └── builder
│ ├── Pizza.java
│ ├── Product.java
│ └── BuilderRunner.java
├── structural
│ ├── adapter
│ │ ├── LegacyPrintable.java
│ │ ├── ModernPrintable.java
│ │ ├── LegacyPrinter.java
│ │ ├── PrinterAdapter.java
│ │ └── AdapterRunner.java
│ ├── decorator
│ │ ├── Burger.java
│ │ ├── RegularBurger.java
│ │ ├── BurgerDecorator.java
│ │ ├── MayoDecorator.java
│ │ ├── OnionDecorator.java
│ │ ├── PickleDecorator.java
│ │ ├── CheeseDecorator.java
│ │ └── DecoratorRunner.java
│ └── facade
│ ├── ApplePay.java
│ ├── VisaCard.java
│ ├── DHL.java
│ ├── MonarchInventoryService.java
│ ├── PaymentService.java
│ ├── InventoryService.java
│ ├── ShippingService.java
│ ├── USPS.java
│ ├── OrderFacade.java
│ └── FacadeRunner.java
└── behavioral
├── strategy
│ ├── Card.java
│ ├── CreditCardStrategy.java
│ ├── DebitCardStrategy.java
│ ├── PaypalStrategy.java
│ ├── PaymentStrategy.java
│ ├── InsufficientFundsException.java
│ ├── ShoppingCart.java
│ └── StrategyRunner.java
├── observer
│ ├── Subject.java
│ ├── Observer.java
│ ├── ChatRoom.java
│ ├── Message.java
│ ├── User.java
│ └── ObserverRunner.java
└── command
├── Command.java
├── Device.java
├── Radio.java
├── Light.java
├── Television.java
├── Light.java
├── TurnOnCommand.java
├── TurnOffCommand.java
├── AdjustvolumeCommand.java
├── ChangeChannelCommand.java
├── RemoteControl.java
└── CommandRunner.java
Implementation Details:
-
Creational Patterns:
-
Structural Patterns:
-
Behavioral Patterns:
Prerequisites :installation of IntelliJ IDE and Java.
0 open intelliJ IDE.
1 Select option CLONE REPOSITORY .
2 Copy and paste url https://github.com/jadogeri/Design_Patterns_Java.git and choose location to save project then press clone.
(Note!! choose empty folder : I created folder repo)
3 Change view to Project.
4 Navigate to design_patterns --> src --> main -- java.
5 To run any of the design patterns (using command pattern for illustration)
Navigate to behavioral --> command --> CommandRunner .
Note!! each pattern has a file ending in *.Runner.java to run the app.
6 Press play button to start application.



