Con­cept of the MVC pat­tern

Web Designer - - Developer Tutorials -

The model/view/ con­troller pat­tern ex­ists to sep­a­rate con­tent, logic and pre­sen­ta­tion. Mod­els are func­tion­al­ity that de­fine ‘how’ things are done. Th­ese are the event han­dlers from steps 11 – 14.

Views are the pre­sen­ta­tion of con­tent. Textform has a spe­cific method called ‘ren­der’, which pro­duces the pre­sen­ta­tion ‘view’ of the form.

Con­trollers de­fine how ev­ery­thing fits to­gether. As a movie, the views would be the spe­cial ef­fects artists, with mod­els be­ing movie ac­tors; con­trollers would act as film di­rec­tors for each part of the movie. Con­trollers tell ac­tors (mod­els) what to do, pass­ing their out­put to the spe­cial ef­fects artists (views) to pro­duce the fi­nal pre­sen­ta­tion.

Newspapers in English

Newspapers from UK

© PressReader. All rights reserved.