Skip to content

Study about Java implementations and design patterns. Includes Singleton, Builder, Abstract Factory, Factory Method, Facade, Observer, Template Method, Adapter and Dependency Injection. Features JavaDocs, demos, organized packages, and practical examples using Spring for DI.

Notifications You must be signed in to change notification settings

AsrielDreemurrGM/Design_Patterns_Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design_Patterns_Java

This repository contains educational implementations of key object-oriented design patterns in Java. Each pattern is organized into its own package and includes:

  • Singleton Pattern: Demonstrates both thread-safe and unsafe variants;
  • Builder Pattern: Explores burger-building scenarios with abstraction and directors;
  • Abstract Factory Pattern: Uses client contracts to generate cars with shared interfaces;
  • Factory Method Pattern: Provides a car production model where each subclass defines its own product creation logic;
  • Facade Pattern: Simplifies subsystem interactions with an apartment registration example;
  • Observer Pattern: Implements event subscription using TV, Newspaper, and Journalist classes;
  • Template Method Pattern: Defines worker daily routines with concrete subclasses overriding specific behaviors;
  • Dependency Injection: Demonstrates Spring-based DI with services and notification senders;
  • Adapter Pattern: Adapts DropBox API to a common file handler interface for unified file operations.

The repository is structured for both learning and practical reference. JavaDocs and inline comments have been added for all files to improve clarity and support self-study.

📂 Structure

  • singleton: Lazy initialization, thread-safe variations, and property-based Singleton examples;
  • builder: Abstract builders, concrete implementations, and a manager class as a director;
  • abstractfactory: Factory hierarchies for cars and clients with/without contracts;
  • factorymethod: Abstract creators define car factories, and concrete factories build specific models like Corolla, Jetta, and Model S;
  • facade: Apartment registration example with simplified interface to complex subsystems;
  • observer: Implements observer pattern with subjects and observers like TV, Newspaper, and Journalist;
  • templatemethod: Abstract worker routines with concrete worker types like Cop, Firefighter, and Manager;
  • dependencyinjection: Spring framework based DI examples with services and notification senders;
  • adapter: Adapter pattern example integrating DropBox with a generic file handler interface.

📅 Commit Highlights

June 1, 2025

  • Added JavaDocs and comments to all files in the dependencyinjection package;
  • Added detailed explanation of Dependency Injection concepts in the Demo file;
  • Created NotificationSender and refined interfaces with prefixed 'I';
  • Demonstrated Dependency Injection using Spring framework.

May 31, 2025

  • Implemented Adapter pattern to integrate DropBox with a common file handling interface (IHandleFiles);
  • Created DropBoxAdapter to adapt DropBox API for uniform file operations;
  • Added mock classes DropBox, DropBoxFile, and GoogleDrive for demonstration;
  • Included demo showcasing file recording and reading through the adapter interface.

May 30, 2025

  • Created Facade pattern example with apartment registration system;
  • Implemented interfaces and concrete classes to simplify subsystem interactions;
  • Added demo to illustrate facade usage.

May 29, 2025

  • Created Observer pattern example with Observer and Subject interfaces;
  • Implemented observers like TV and Newspaper and subject Journalist to manage notifications;
  • Added demo showing observer registration and notification flow.

May 29, 2025

  • Renamed factory package to abstractfactory for clarity;
  • Created new factorymethod package to demonstrate the Factory Method pattern;
  • Implemented Car abstract product with basic behaviors like startEngine and fuelCar;
  • Created factories for specific cars: CorollaCarFactory, JettaCarFactory, and ModelSCarFactory;
  • Enhanced JavaDocs to better explain the Factory Method concept and demo flow.

May 27, 2025

  • Added JavaDocs to all classes and methods;
  • Implemented client-type factories with matching car variations;
  • Enhanced demo logic with dynamic class-based print output.

May 26, 2025

  • Completed Builder pattern with burgers, manager, and variation builders;
  • Reorganized files and added supporting comments.

May 25, 2025

  • Added thread-safe and unsafe Singleton demos with detailed documentation;
  • Wrote JavaDocs and inline comments to explain multithreading issues.

May 24, 2025

  • Implemented classic Singleton pattern with lazy initialization;
  • Added property-based Singleton variant for enhanced control.

About

Study about Java implementations and design patterns. Includes Singleton, Builder, Abstract Factory, Factory Method, Facade, Observer, Template Method, Adapter and Dependency Injection. Features JavaDocs, demos, organized packages, and practical examples using Spring for DI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages