Agenda
Factory Method
factory Design Pattern
Abstract factory
I
Factory Method
case
that interface abstract
1 new MongoDbDatabase
User Service
Ls new MySQLDatabase
ᵈÉÉTÉ ᵈt dm
select from user
Query query db createQuery
execute
1
query
register Use1
7
Query query db createquery
query execute
I
would want Databate to be an interface abstract class
We
we want we can change the database
Why
So in future if
easily
connect 1
m
KIM
f g May incur
i
F
fffefama.wmss.name MySQLQuery a new Mysardwery
Is
MysolQuery
Query createquery112
in
string query
1 nature new MySQLQuery query
y
same return as defined in
Overriden method can have the type
in interface
interface or child of the type defined
amstn.net
f.int
ChayaPoole f
connect
I
What is the purpose of this method MySL
To return a new object of the corresponding query Mosa
This is called your factory method
UserService
Database db
Query query
ViceServiceC
1 if
db instance of MongoDB
query new NoSQLQueryC
I'm 1 guy now mysa quages
responsibilities
Has attributes and methods
a Database
that are required by
connect
class
anaff
changeUrl11
stfstar
in a
of fatory
muggy p methods toget objects of
createUpdater 7 Updater corresponding diff types
getversion
1
t EE
AbstrutFntory
Keep all attributes that Database should have
Keep all factory methods at a separate place
LRDatabas
iii.int
size createtransaction C transaction
Hotheaded
manoeuvres updates
getversion
createDatabasefactory 1
Returns corresponding
Imy
User Service
thtithefitory dbfatory ab createDatabasefactory
teenager
hf
g
EII.mn
ID raffydratory
meatellwery
6 nowmysal
factory
9
y
chelation 174
Query returnMysatrom 1
Jan 1
11
v1 Libraries
ketone
Flutter Mattained Help you develop
coffins code
Fetoktranspayk write once
ap Android 405 Tues
Itunes
ios
iosButton
Android
Android Button
Flutter
crateButtonC
create Menne
create Drop down
create teat
settheme 1
I setRefreshRatel
arenas
Selthenne C
1
17
41
Impregnated create Manne
create Dropdown
create tent
Android
fsuraatoyI
D.tl
1
17