2. {{Insert clever quote}}
“ The secret to building large apps is NEVER build
large apps. Break up your applications into small
pieces. Then, assemble those testable, bite-sized
pieces into your big application. ”
Justin Meyer, JavaScriptMVC
18. Why?
separate data and storage
bonus: decouple client and server
bonus x2: testing gets easier
19. Example
Traditional fetching of data
$gt"pss,fnto(aa sau){
.e(/ot" ucindt, tts
i (tts= 44 {
f sau = 0)
rtr soErr)
eun hwro(;
}
vrpss=dt.ot;
a ot aapss
rnePsspss;
edrot(ot)
};
)
Fetching data with data source
vrdtSuc =nwDtSuc(
a aaore e aaore{
tasot {ra:"pss }
rnpr: ed /ot" ,
shm:{dt:"ot"}
cea aa pss
};
)
dtSuc.id"hne,rnePss;
aaorebn(cag" edrot)
dtSuc.id"ro" soErr;
aaorebn(err, hwro)