Dan,
Over on http://www.macromedia.com/devnet/flex
you'll see I've been serialising a bunch of articles on the various patterns in
Cairngorm - and that the View Helper is conspicuous by it's absence.
That's not to say that the View Helper can't still be a
useful pattern in your development; but rather we found people were overusing
them, were not taking advantage of some of the core features of Flex (such as
data-binding and formatters), and were abdicating responsibility to create
application-specific object models (eg ShoppingCarts, WishLists, etc) by instead
just shoe-horning "all the rest of their code" into "view
helpers".
Cairngorm started life as a microarchitecture for
Flash-based RIAs, and has migrated towards Flex in it's implementation, because
we believe that Flex is the most appropriate platform for delivering the kind of
applications that Cairngorm assumes you are building. The View Helper
pattern had a great deal of utility with Flash-based RIAs, allowing us to
encapsulate all of the implementation of a view
(_root.whatever.deeper.evenMoreObscure.moveclip.submovieclip.loginform.password)
into simple getters and setters that abstracted the RIA application developer
from the Flash developer's chosen implementation of the view. This is
discussed in detail in the ActionScript 2.0 Dictionary (where Alistair and
I first wrote about the full set of patterns in Cairngorm), the PDF chapter of
which is available for download here - http://www.richinternetapps.com/archives/000128.html
However, we introduced the ModelLocator pattern to the
community as a better way of achieving this decoupling from the UI
implementation; instead using data-binding to bind a view to an object model,
rather than getting and setting onto the view.
This means that the View Helper is more correctly used to
"prepare the model for the view" - ie if you have raw data on your model (such
as a floating point number) that you want to in some way "beautify" before it is
bound to the user-interface, a ViewHelper class would allow you to achieve
that. In this regard however, a View Helper is increasingly becoming a
concept rather than a concrete class - to me, a Flex formatter (eg
CurrencyFormatter) is a view helper, a function binding is a view helper,
having a code-behind class for your MXML can be considered a View
Helper.
I'd rather turn this around on it's head ... what are you
trying to achieve with Cairngorm that you think might merit a View Helper
? Let us understand a specific problem, and perhaps we can discuss in the
context of a solution. If on the other hand, you're just trying to wrap
your head around all the various components of Cairngorm, focus on the
ModelLocator, defocus on the View Helper, and I expect you'll be able to build
what it is you're trying to build.
Kindest Regards,
Steven
|
Of Dan
Thomas
Sent: 12 March 2006 18:15
To: flexcoders@yahoogroups.com
Subject: View helpers
Sent: 12 March 2006 18:15
To: flexcoders@yahoogroups.com
Subject: View helpers
Can anyone offer a simple example of the view helper pattern? I understand the gist of it, but can only find explanations for Java in which i get a little lost with javaisms. A flex orinetated sample or metaphoric explanation i think should help.
Cheers,
Dan
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.