Page 257 -
P. 257

web development


           Design your webapp with MVC


           Now that you have an idea of the pages your webapp needs to provide, your
           next question should be: what’s the best way to build this thing?

          Ask 10 web developers that question and you’ll get 10 different answers; the
           answer often depends on whom you ask.
           Despite this, the general consensus is that great webapps conform to the
           Model-View-Controller pattern, which helps you segment your webapp’s code
           into easily manageable functional chunks (or components):






                               The Model
                               The code to store (and sometimes process) your webapp’s data









                               The View
                               The code to format and display your webapp’s user interface(s)








                               The Controller
                               The code to glue your webapp together and provide its business logic








           By following the MVC pattern, you build your webapp in such as way as to
           enable your webapp to grow as new requirements dictate. You also open up the
           possibility of splitting the workload among a number of people, one for each
           component.

           Let’s build each of the MVC components for your webapp.


                                                                                      you are here 4    221
   252   253   254   255   256   257   258   259   260   261   262