PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: eco_bach on October 06, 2011, 08:24:03



Title: XML and dropdown menus-use VO(s) to wrap XML or?
Post by: eco_bach on October 06, 2011, 08:24:03
Hi
Smart VO's are great when you have a single entity defined in XML, but what about say, XML for a drop down navigation?
Is there an efficient way to represent this data(multiple entities) using a single 'smart' VO, or is it better to keep the data as XML and let the views do the parsing?


Title: Re: XML and dropdown menus-use VO(s) to wrap XML or?
Post by: puremvc on October 06, 2011, 12:00:55
I would avoid doing the parsing in the views. By writing more intelligent VO wrappers for the XML you create a 'Single Point of Truth' or SPOT[1] rather than distributing the XML handling all throughout the app. Because the XML structure is likely to change as you build, if you let disparate parts of the app massage the XML, you're bound to run into duplication of effort. And as the XML changes, inevitably you'll end up going around the app cleaning up all that stuff.

To this point, in a book I'm writing for O'Reilly at the moment, I'm presenting a very deep XML hierarchy, and the VOs wrapping it take on some heavy responsibility that challenge the simple data-carrier notion that is usually associated with VOs. The book won't be out until sometime in December, but being a longstanding PureMVC community member, I can probably get you on the tech review list so you can get an early peek. Just shoot me an email if you're interested.

-=Cliff>

[1] http://en.wikipedia.org/wiki/Single_Point_of_Truth