GoConqr has a new look! Let us know what you think.

Notes

Design patterns

Suhas S English 6 pages

Content of the notes (6)

Page 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

Page 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.

Page 3

Factory Method

Return one of serveral classes that share a common super class

Page 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/

Page 5

Observer pattern:

observer(subsciber) - interface

subject(publisher) - interface

subject will add, delete observer

create class implementing subject with list of observers.

Page 6

Abstract Factory:

Like a factory, but everything is encapsulated.

Information

Description
Note on Design patterns, created by Suhas S on 30/03/2018.
Created by
Suhas S
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?