Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resources for implementing MVVM (ViewModel) pattern in Flex?

Can anyone direct me towards some code or a tutorial for implementing the ViewModel in Flex 3?

All I'm finding on the web are examples for Silverlight.

like image 463
TERACytE Avatar asked Jan 11 '10 17:01

TERACytE


3 Answers

Martin Fowler has also written about these ideas in the past under the term "Presentation Model". So you might find useful tutorials under that search phrase as well since it's not an "MS invented term". :-)

Indeed, this MS overview material acknowledges Fowler's work directly

In 2005, John Gossman, currently one of the WPF and Silverlight Architects at Microsoft, unveiled the Model-View-ViewModel (MVVM) pattern on his blog. MVVM is identical to Fowler's Presentation Model, in that both patterns feature an abstraction of a View, which contains a View's state and behavior. Fowler introduced Presentation Model as a means of creating a UI platform-independent abstraction of a View, whereas Gossman introduced MVVM as a standardized way to leverage core features of WPF to simplify the creation of user interfaces. In that sense, I consider MVVM to be a specialization of the more general PM pattern, tailor-made for the WPF and Silverlight platforms.

like image 192
verveguy Avatar answered Nov 19 '22 06:11

verveguy


I wanted to share a comparison I wrote up of MVVM (Silverlight) vs PresentionModel (Flex). It shows how the two implementations of the same pattern differ/compare:

http://houseofbilz.com/archives/2010/12/29/cross-training-in-silverlight-flexmvvm-vs-presentation-model/

like image 29
Brian Genisio Avatar answered Nov 19 '22 04:11

Brian Genisio


The reason all of the examples your finding are for Silverlight is because MVVM is by-and-large a Microsoft invention. It has to do with the ease of tying WPF views with data. The "ViewModel" is little more than a way of describing a subset of functions performed by the Controller in a traditional MVC design model; some MVVM descriptions even include a controller.

With that said, it doesn't really matter whether your app follows the MVVM or MVC models precisely. It's more of a high-level, organizational idea that should guide your design and development. If you're totally clueless about the models you can find any number of quickie web tutorials, and probably some printed literature on the subject.

like image 1
iandisme Avatar answered Nov 19 '22 05:11

iandisme