Skip to content

masterrr/Software-Patterns

Repository files navigation

Software design patterns, written in Java

Strategy Pattern

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

Folder: Strategy Pattern

Observer Pattern

Object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes

Folders:

  • Observer Pattern

    Custom pattern implementation

  • Observer Pattern (java.util)

    Pattern implementation using java.util library

  • Observer Pattern (swing)

    Pattern implementation using awt / swing libraries

Decoration Pattern

Allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class

Folders:

  • Decoration Pattern

    Custom pattern implementation, I took “coffee-company” way to demonstrate

  • Decoration Pattern (decoration io)

    Lower Case concrete LowerCaseInputStream decorator class written under FilterReader abstract class-decorator for java.io.Reader

    buttons

Simple Factory Pattern

Simple Factory Pattern is just an object for creating other objects.

Folder: Factory Simple Pattern

Factory Pattern

Factory pattern defines a creating objects interface, but gives ability to choose class of objects to its subclasses => factory pattern delegates creating objects to its subclasses.

Folder Factory Pattern

Singleton Pattern

Singleton pattern defines only one class instance, which provides one global access point to some resources.

Folder Singleton Pattern

About

Software Design Patterns in Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages