6. JAIN
–
DEEMED
TO
BE
UNIVERSITY
GLOBAL
CAMPUS:
45th
km
NH
-
209
Jakkasandra
Post,
Kanakapura
Rd,
Bengaluru,
Karnataka
562112
Department of CSE
✓ Started in 1987 by Ward Cunningham and Ken Beck who were
working with Smalltalk and designing GUIs.
✓ Popularized by Gamma, Helm, Johnson and Vlissides (The gang
of four, Go4)
✓ The three of Go4 were working on frameworks (E++,Unidraw,
HotDraw)
✓ Design pattern use a consistent documentation approach
✓ Design pattern are granular and applied at different levels such
as frameworks, subsystems and sub-subsystems
✓ Design patterns are often organized as creational, structural or
behavioral
Patterns - Background
4/5/2023 OOAD by Dr. Vikram Neerugatti 6
12. JAIN
–
DEEMED
TO
BE
UNIVERSITY
GLOBAL
CAMPUS:
45th
km
NH
-
209
Jakkasandra
Post,
Kanakapura
Rd,
Bengaluru,
Karnataka
562112
Department of CSE
✓ Defines an interface for creating an object ,but let
subclasses decide which class to instantiate.
✓ Factory Method lets a class defer instantiation to
subclasses.
✓ Motivation:
✓ Framework use abstract classes to define and
maintain relationships between objects
✓ Framework has to create objects as well - must
instantiate classes but only knows about abstract
classes - which it cannot instantiate
✓ Factory method encapsulates knowledge of which
subclass to create -moves this knowledge out of the
framework
Creational – Factory Method
4/5/2023 OOAD by Dr. Vikram Neerugatti 12
17. JAIN
–
DEEMED
TO
BE
UNIVERSITY
GLOBAL
CAMPUS:
45th
km
NH
-
209
Jakkasandra
Post,
Kanakapura
Rd,
Bengaluru,
Karnataka
562112
Department of CSE
✓ Define an object that encapsulates how a set of
objects interact.
✓ Mediator promotes loose coupling by keeping objects
from referring to each other explicitly, and lets you
vary their interaction independently.
✓ Classes interact only with a mediator class rather
than with each other.
✓ Classes are coupled only to the mediator where
interaction control code resides.
✓ Mediator is like a multi-way Façade pattern.
✓ Analogy: a meeting scheduler
Behavioral - Mediator
4/5/2023 OOAD by Dr. Vikram Neerugatti 17