1 / 14

Model-View-Controller in Web Applications

Model-View-Controller in Web Applications. Jan Tvrdík. Model- V iew - C ontroller. MVC software architecture model – business logic view – what the user sees controller – responds to user events . History. lots of slightly different implementations Trygve Reenskaug

aliya
Download Presentation

Model-View-Controller in Web Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Model-View-Controllerin Web Applications Jan Tvrdík

  2. Model-View-Controller • MVC • software architecture • model – business logic • view – what the user sees • controller – responds to user events

  3. History • lots of slightly different implementations • TrygveReenskaug • 1st draft released in the May 1979 • Model-View-Editor • 2nd draft released in the December 1979 • Models-Views-Controllers

  4. The First Implementation • Model-View-Controller as known today • Written in Smalltalk in 1987 • Considered to be the “Classic MVC“

  5. MVC Diagram Controller Model View

  6. Model • Data + business logic • Meaning of data • Behavior of application • Communication with database • Calculations • Not aware of view / controller existence

  7. View • Visual representation of its model • May highlight or suppress certain attributes of the model • Active = directly communicates with model • Passive = communicatesonly with controller

  8. Controller • Glue between model and view • Processes the user request • Changes the model • Redraws the view • More complicated in web apps

  9. Front Controller • Processes the HTTP request • Picks a specific controller

  10. Front Controller Model Front Controller Controller Controller Controller View View View Request

  11. Useful guidelines • If you change the name of column in database, you shouldn’t need to edit the code of view and controller. • If you change the HTML output to Flash, you shouldn’t need to edit model’s code. • If you change the position of certain elements on page, you shouldn’t need to edit the code of controller and model.

  12. Advantages • Improvescodeorganization • Codetestability • Codereuse • Extensibility • Adapted by most web frameworks

  13. Disadvantages • Increasedcodecomplexity • MVC paradoxes

  14. Conclusion • MVC has no exact definition • Start using MVC today! • Find a good framework

More Related