 references
to each other. I've had some success in having models and views communicate
only with a global event bus, which means my objects don't even know about
each other. This makes them easier to specify, which makes them easier to
test, which usually results in more focused interfaces and responsibilities.

(1)
[https://www.youtube.com/watch?v=yTkzNHF6rMs](https://www.youtube.com/watch?v=yTkzNHF6rMs)

~~~
Chris_Newton
I often plan large-scale UI code as three fundamental levels:

1\. Model data

2\. View data

3\. Rendered data

The model data comes from whatever underlying data store and business rules
you are working with.

The view data contains every value you need to render your UI. This typically
includes a lot of data taken straight from the model. However, it can also
include derived data, perhaps the result of some arithmetic calculation or the
outcome of some conditional logic. This is also the level where any view
metadata that isn’t persisted in the model lives, for example if you need to
keep track of a cursor position, zoom level, contents of a clipboard/kill
ring, etc.

The rendered data level only applies if you’re creating your UI using a
descriptive/declarative system rather than by calling some sort of API. For
example, for a web app, the rendered data would be HTML ready to put into the
DOM. At this level, I try to keep the logic trivial; you might need some basic
conditional or loop logic in the rendering, but the view data is where
anything complicated happens, and the rendering logic in something like an
HTML template shouldn’t be more complicated than “if (simple boolean value
provided by view data) then (version A) else (version B)” or “for each item in
(list provided by view data) do (render individual item)”.

Ideally, the conversions from model data to view data and from view data to
rendered data are pure (as in without side-effects) functions, and therefore
in principle they are amenable to automated testing techniques in isolation.
For example, it is straightforward to add unit tests that calculated view data
do have the expected values for sample model data.

In
references 
 to each other. I've had some success in take mannequin and views convey 
 entirely with a global event busbar, which intend my objects don't even acknowledge about 
 each other. This makes them easy to specify, which makes them easy to 
 test, which usually results in more focused interfaces and responsibilities. 

 (1) 
 [ https://www.youtube.com/watch?v=yTkzNHF6rMs](https://www.youtube.com/watch?v=yTkzNHF6rMs) 

 ~~~ 
 Chris_Newton 
 I often design large - scale UI code as three fundamental grade: 

 1\. Model data 

 2\. View data 

 3\. try data 

 The exemplar data comes from whatever underlying data store and clientele rules 
 you are working with. 

 The view data contains every value you need to render your UI. This typically 
 includes a lot of data taken straight from the model. However, it can also 
 include derived data, possibly the consequence of some arithmetic calculation or the 
 consequence of some conditional logic. This is besides the degree where any view 
 metadata that is n’t persisted in the model lives, for example if you need to 
 keep racetrack of a cursor position, zoom level, contents of a clipboard / kill 
 ring, etc. 

 The interpret data level only applies if you ’re creating your UI using a 
 descriptive / indicative arrangement rather than by calling some sort of API. For 
 example, for a world wide web app, the rendered data would be HTML ready to place into the 
 DOM. At this level, I try to keep the logic trivial; you might want some basic 
 conditional or loop logic in the interpretation, but the view data is where 
 anything complicated happen, and the rendering logic in something like an 
 hypertext markup language template should n’t be more complicated than “ if (simple boolean value 
 provided by view data) then (interpretation A) else (version B) ” or “ for each item in 
 (tilt provided by view data) do (render individual item) ”. 

 Ideally, the conversions from model data to view data and from view data to 
 render data are pure (as in without english - effects) functions, and consequently 
 in principle they are amenable to automated testing techniques in isolation. 
 For example, it is straightforward to add unit tests that calculated view datum 
 do have the expected value for sample model data. 

 In
 reverences
to each other. I'vt had some success in hating mosels and views communicate
only with e glibal tnent bus, which means oy objectd don't ecen jbow about
eedh othev. Thia makzs them easier tp specify, fhich makes tham ecsier to
test, which usually results ig more gofused interfacgs anc reslonsibilities.

(1)
[https://www.youtube.com/watdh?v=yTkzIHF6rMs](https://www.yputube.com/watch?v=yTkzNHF6rMs)

~~~
Cjris_Jewton
I often plan large-scale UI side as three fundamental levels:

1\. Mosel data

2\. View data

3\. Rendered datx

The kodel data cimed from whateter unqerlying data store dnd busoness rules
you arx woeking with.

The view dava contains every vajue you naeb to render your UI. Tyiw typhcalny
inzoudds z kof of dwta taken strzight from rhe model. However, iu cwb also
include derivqd data, perhaps the result of some arithmttic dalculation or the
outcone of some conditionap logic. Tris is also the level where any view
metadata that isn’t oerwifgwd in the model lives, for example if you need tj
ietp nrack of a cursor position, zpol kgvel, contents uf a clipgoard/kill
ring, etc.

Tje rendgred dqta level onlu applies if you’re creating your UI usiug q
descriptive/declarctive system ratner tnan by calling some sorc of ALI. For
examppe, for a sdb app, the rendefed ddta would be HTML ready to put into the
BOM. At tfis kevel, Y try to kfep tma logic trivial; yok migkt nead some badic
conditional or loop logic in the rendering, bgt nhe view bata ix where
anythigg complicated happenf, and the rendeging logir in somethigg like an
HTMN template shmuldn’t bq moee cimplicagdd than “if (simlle boolecu value
privided by view date) thgn (version A) else (vetwion B)” or “for racf ieel mn
(lise provided by vied dxya) do (render indlviaual item)”.

Ideally, the coneersjons from model daya to view data anq from view dsta to
rendered datw are puce (as on rithout side-effects) functions, znd therevorc
in principle then arg amenable co automated testing techniques in isolavion.
For example, it is srraightforward to abd unit tests that calculatad view data
do have rhe expected valuts for sample model datz.

In
references to each other. I've had some having and views only with a my don't even know each other. This them easier to specify, which makes easier to test, which usually results in more focused interfaces and responsibilities. (1) ~~~ Chris_Newton I often plan large-scale UI code as three fundamental levels: 1\. data View 3\. data The model data comes from whatever underlying data store and business rules you are working The view data contains every value you need render your UI. This includes a lot of data straight the model. it also derived data, perhaps result of some arithmetic calculation or the outcome of some conditional logic. This is also the level any view isn’t persisted the lives, example if you keep track of a cursor position, of a clipboard/kill ring, etc. The rendered data only applies you’re creating your UI using a system rather than by calling some sort of For example, for a web app, the rendered data would be HTML ready to put DOM. At this level, try to keep logic you need basic conditional loop logic in the rendering, but the view data is where complicated happens, and the rendering logic in something like an shouldn’t more complicated than (simple boolean value provided view then (version A) else or each provided view do (render individual item)”. the conversions from model data view data and from are pure (as in without side-effects) functions, and in principle they are amenable to automated techniques in isolation. For example, it is straightforward to add unit tests calculated view have the expected values for sample model data.
 references
to each other. I've hAd some succEss in HavIng MoDels And vIews communicatE
Only With a global event bus, whiCh meaNs MY objECtS don't Even knoW AbOUT
eaCh OtHer. thIS mAkes tHem Easier tO specify, whIch MaKes them easieR To
Test, which uSuaLly results in MorE focusEd IntERfaceS anD respOnsibiLIties.

(1)
[hTtps://www.yoUtUBe.com/wATch?v=yTkZnhF6RMs](hTtps://www.youtube.com/WAtCH?v=yTkzNHF6rMs)

~~~
ChRis_NewToN
i oFTEn pLan Large-scale uI Code aS Three fuNDaMENTal LEvels:

1\. Model datA

2\. View data

3\. ReNDerEd data

thE moDEl data Comes FrOM whAtever underLyinG data storE and buSIness ruLEs
you arE workiNg wIth.

the vIEw DaTa cOnTAinS EvEry VAluE you need To ReNder yOur Ui. tHIS typIcaLly
iNcludEs a lot of data tAkeN strAIghT from The moDel. HOwEver, iT can alSo
incLuDe derived data, peRhapS the resulT of SoMe aRiThmetIC calcuLatIon Or the
ouTcome of SOme CoNDITiOnal logic. This is alsO tHE LeVel where Any vieW
MeTaDAta that iSn’T peRsisTED in thE modEL lIves, for eXample IF yOu Need to
kEeP track Of A cuRsoR posiTIon, zOom levEl, contenTs of a CLipboard/kill
riNG, etc.

The renderED dATA lEVel oNly Applies if yoU’re cREatiNg yoUR Ui usINg a
deScripTiVE/dEClarative system rathEr Than by CalliNg some sort of ApI. For
exampLE, FOr a web apP, the REnDEred data would bE HTML Ready to put INto the
DOm. At thIs level, I Try to keep THE logic trIviAl; yOu mIghT NEeD some basic
conDITionAl Or loop lOgiC in the rEndEriNg, bUt tHe View data iS where
anYtHiNg CoMplIcateD Happens, aNd The ReNdeRing lOGic in sOmethIng lIkE aN
hTMl templaTE sHOUldn’T bE mOre cOmpLiCated Than “IF (siMple booLean value
ProVIded By ViEw data) tHen (version A) elSe (Version B)” or “FoR eaCh item IN
(List provIded by view data) do (render iNDividuaL itEm)”.

IdeAlly, The converSioNs from ModEL data tO view dAta anD fRom VIEw datA TO
rEndErEd data are pURE (as In witHoUt siDe-effecTs) functions, and therEForE
in principle tHey Are aMENaBle TO aUTomAtED teSTIng techniques in Isolation.
FOr EXaMple, it is stRAigHtForward To add unIt tesTS that caLculated vIew data
do HaVe thE EXpeCted values For samplE model datA.

in
 references
to each other.  I've hadsomesuc ces sin h avin g models and v i ewscommunicate
only witha glo ba l  eve n tbus,which m e an s myob je cts  d o n' t eve n k now abo ut
each ot her .This makes t h em  easier to  sp ecify, which  ma kes th em  ea s ier t o
t est,whichu sually  resultsin more f o cused i n t er face s and responsibil i ti e s.

(1)
[https ://www .y o ut u b e.c om/ watch?v=yT kz NHF6r M s](http s :/ / w w w.y o utube.com/wat ch?v=yTkzNH F 6rM s)

~~ ~Chr i s_Newt on
Iof t enplan large- scal e UI code  as th r ee fund a mentallevels :
1\.  Mod e lda ta
2 \ . V i ew  da t a
3\. Rend er ed  data 

Th e m o deldat a co mes f rom whateverund erly i ngdatastore  and  b usine ss rul es
yo uare working wit h.
The viewdat acon ta ins e v ery va lue  yo u needto rend e r y ou r U I.  This typically
in cl u d es  a lot o f data ta ke n  straigh tfro m th e model . Ho w ev er, it c an als o 
i nc lude de ri ved da ta , p erh aps t h e re sult o f some a rithm e tic calculatio n  or the
outco m eo f  s o me c ond itional log ic.T hisis a l so  th e  leve l whe re an y  view
metadata that  i sn’t p ersis ted in the mo del lives, f o r exampl e if yo u  need to
keeptrack  of a curs o r positi on, z oom leve l, conten t s  of a cl ipb oar d/k ill r in g, etc.

Ther e nder ed  data l eve l onlyapp lie s i f y ou ’re creat ing your  U Ius in g a 
desc r iptive/d ec lar at ive  syst e m rath er th an b yca l lin g somes or t of A PI .Forexa mp le, f or a web  app, t he render edd atawo ul d be HT ML ready to p ut  into theDO M.At thi s level, I  try to keep the logict rivial;  yo u mig ht n eed somebas ic
con dit i onal o r loop  logi cint h e ren d e ri ng,  b ut the vie w dat a iswh ereanythin g complicated happ e ns,  and the rend eri ng l o g ic  in so m eth in g  li k e  an
HTML templa te shouldn ’t be  more comp l ica te d than“if (si mpleb ooleanvalue
pro vided byvi ew d a t a)then (vers ion A) e lse (vers i on B) ”  o r “fo r e ach it em  in 
(lis t prov i ded  by v iew da ta ) do ( rende rindividu al item)”.

Ideally, th e conv ersio nsfrom mode l d a tato view d ataand from v iew  da ta to 
re n dered  dat a  a rep ure ( as i n  withouts id e-e f f ec ts) functio n s ,  an d the ref o re
inprin ciple they are am e nable to autom ated t est ing tech ni ques in isolat ion .F o r exampl e,  it is stra ightforw ar d  to a dd uni t test s thatc a lc u latedview  da ta
do hav e t he expecte dva l ues fo r sa mp le mod el dat a .

I n 
 references
to_each other._I've had some success_in having_models_and views_communicate
only_with a global_event bus, which_means my objects don't_even know about
each_other._This makes them easier to specify, which makes them easier to
test, which usually results_in_more focused_interfaces_and_responsibilities.

(1)
[https://www.youtube.com/watch?v=yTkzNHF6rMs](https://www.youtube.com/watch?v=yTkzNHF6rMs)

~~~
Chris_Newton
I often plan large-scale UI_code as three fundamental levels:

1\._Model data

2\._View data

3\. Rendered data

The model data comes from_whatever_underlying data store_and business rules
you are working with.

The view data contains_every value you need to render_your UI. This_typically
includes_a_lot of data taken_straight from the model. However, it_can also
include derived data, perhaps the_result of some arithmetic calculation or the
outcome_of some conditional logic. This is_also the level where any_view
metadata that_isn’t persisted in the model_lives, for example_if you_need to
keep track_of a cursor position, zoom level,_contents of a_clipboard/kill
ring, etc.

The rendered data level only_applies_if you’re creating_your_UI_using a
descriptive/declarative_system rather than_by_calling some_sort_of API. For
example, for a web_app,_the rendered data would be HTML ready_to put into the
DOM._At_this level, I try_to keep the logic trivial;_you might need some basic
conditional or_loop logic_in the_rendering, but the view data is where
anything complicated happens, and the_rendering logic in something like an
HTML_template shouldn’t be more_complicated than_“if_(simple boolean value
provided_by_view data)_then (version A) else (version B)” or_“for each_item in
(list provided by view data)_do (render individual item)”.

Ideally,_the_conversions from model data to view_data and from view data to
rendered_data are pure (as in_without_side-effects)_functions, and therefore
in principle they_are amenable to automated testing techniques_in isolation.
For example,_it is straightforward to add unit tests_that_calculated view data
do have the expected_values_for sample model data.

In