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
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
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
Simple Factory Pattern is just an object for creating other objects.
Folder: Factory Simple 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 defines only one class instance, which provides one global access point to some resources.
Folder Singleton Pattern