Notizen
Design patterns
Inhalt der Notizen (6)
Seite 1
There are 3 types:
Creational - Singleton, Factory, Abstract Factory, Builder, Prototype
Structural - Adapter , composite, Proxy, Flyweight, Facade, Bridge, Decorator
Behavioral - Temp;ate Method, Mediator, Chain of Responsibility, Observer, Strategy, Command, State, Visitor, Interpreter, Iterator, Mememto
Seite 2
Singleton: Singleton pattern restricts the instantiation of a class and ensures that only one instance of the class exists in the java virtual machine
The singleton class must provide a global access point to get the instance of the class.
Singleton pattern is used for logging, drivers objects, caching and thread pool.
Singleton design pattern is also used in other design patterns like Abstract Factory, Builder, Prototype, Facade etc.
Seite 3
Factory Method
Return one of serveral classes that share a common super class
Seite 4
Strategy Pattern:
crate interface with a method, create classes implementing them.
create an object of interface type in a class
subclasses can instantiate interface type by calling classes which implement interface method in their own way.
Check this out
http://www.newthinktank.com/2012/08/strategy-design-pattern-tutorial/
Seite 5
Observer pattern:
observer(subsciber) - interface
subject(publisher) - interface
subject will add, delete observer
create class implementing subject with list of observers.
Seite 6
Abstract Factory:
Like a factory, but everything is encapsulated.
Informationen
- Beschreibung
- Notiz am Design patterns, erstellt von Suhas S am 30/03/2018.
- Erstellt von
- Suhas S · Mär 2018
- Aktualisiert
- 30 Mär 2018
- Aufrufe
- 1
- Bewertung