News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Ibuildings techPortal:
Create MVC Meet the ViewModel Pattern
November 02, 2010 @ 10:19:18

On the Ibuildings techPortal, there's a new tutorial posted from Barney Hanlon looking at a new method that developers can use in their applications to give MVC apps a better way to handle their presentation logic - ViewModel.

This provides MVC applications a natural location for presentation logic and lazy functionality while maintaining the segregation between the layers of responsibility within the code. It allows designers access to data and methods they need, while hiding aspects that aren't needed at view level. [...] Indeed, pretty much any modern Web framework has an understanding of the important segregation of duties inherent within MVC. It is precisely this segregation that leads to a certain greyness around the all-important View, particularly on sites where multiple content items are displayed in different ways.

The tutorial he includes shows how to set up a site with multiple articles per page that can be shown as either headlines or just title text. He talks about three ways to accomplish this - the usual injection of all data into the view and having it handle it there, injecting a model directly and extracting data from it and the ViewModel approach (a combination of the Decorator and Adapter design patterns).

0 comments voice your opinion now!
viewmodel framework view presentation model inject


blog comments powered by Disqus

Similar Posts

Davey Shafik's Blog: Sneak Peek: Zend_Service_Server - name and framework subject to change

Aleksey Zapparov's Blog: How to handle unexistence controllers/actions with Zend_Controller

Mathias Verraes: Form, Command, and Model Validation

Juan Treminio's Blog: Getting Started with Kohana 3 (series)

Stefan Koopmanschap's Blog: symfonyUnderControl: lime integration with phpUnderControl


Community Events

Don't see your event here?
Let us know!


framework api series application community interview release php7 symfony2 composer introduction example podcast extension version voicesoftheelephpant laravel library opinion performance

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework