Yes, I agree. If you look at the post that I sent to Ralf, you'll see that there is a lot of AS in the ViewHelper. I started with a script tag inside the view and moved it to a ViewHelper for readability. That way if I needed to change the way the view looked, I would edit the view. If I wanted to change the functionality, I would edit the ViewHelper. I don't know, it seems like apples and oranges. I'm just interested in different opinions here. I appreciate your feedback.
-TH --- In flexcoders@yahoogroups.com, "Dimitrios Gianninas" <[EMAIL PROTECTED]> wrote: > > Hey Tim, > > You wrote "like setFocus(), filtering a DataGrid, updating a > search parameter VO with view component values prior to executing a > search command" .... > > Those kinds of things I do in an AS script block for the particuliar component. Like Jesse mentioned, I too used to created ViewHelpers that used to just have all the code related to a particuliar view, when in fact I should have simply put everything in a script block and it would have done exactly the same thing. > > The other thing to remember in Flex development is that you are creating components (most of which are views), so make sure you creating the smallest possible component so you, so the code in the script block isn't actually that much. Plus it makes the component reusable and easy to maintain. > > Hope that helps, > > Dimitrios > Optimal Payments Inc. > > > -----Original Message----- > From: flexcoders@yahoogroups.com on behalf of Tim Hoff > Sent: Mon 7/3/2006 5:01 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: Cairngorm2: ViewLocator - ViewHelper > > Thanks for the responses guys, > > Dimitrios: > Yes, the majority of my views are updated through binding to the > ModelLocator. However, there are certain functions that are soley > view-related (like setFocus(), filtering a DataGrid, updating a > search parameter VO with view component values prior to executing a > search command), that imo don't merit creating a command to > perform. These kind of functions could just be located in a script > tag inside the view. But, if the functions are numerous, the code > becomes more readable if a seperate class is used. > > Bjorn: > I agree that a command shouldn't interrogate a view. That would > defeat the encapsulation. For the most part though, the command > should update the ModelLocator and the ModelLocator should update > the view. > > Jesse: > As always, you crack me up. In the situations that I mentioned > above, I assume that you are using a ViewLocator - uid approach. > This is probably more efficient and centralized than using > ViewHelpers. Besides, I really don't want to deal with Satan > spawn. Care to share a small sample of your approach? > > All in all, this isn't a huge issue. Out of my current 300 views, > I've only found the need to use three ViewHelpers. My questions are > more theoretical and best practice oriented. Good stuff to know > when scalability is an issue. Also, I'm still not sure what Alex > Uhlmann meant by "the ViewHelper adds and removes itself from the > ViewLocator". Guess I need to take a trip back to the Cairngorm > source. > > Thanks again for your answers. I was hoping that Steven or > Alistaire had time to chime in here, but I realize that they are > very busy these days. > > Cheers, > Tim Hoff > > > --- In flexcoders@yahoogroups.com, "JesterXL" <jesterxl@> wrote: > > > > ViewHelpers == spawn of satan. Nothing here but bloated > code. "Seperation > > of concerns" doesn't count here; it's just something they say to > make > > themselves feel better by using them. > > > > ViewLocators, to me are only justified in extreme use cases. > Having other > > View's, or even Commands specifically telling other views to do > certain > > things are bad practice, but I have seen times where there is just > no other > > way. The rest of the time, databinding and combinations of > getter / setters > > should accomplish what you want. While their use should be > discouraged, > > I'll be the first to admit they are useful and lifesavers when you > need > > them. > > > > > > ----- Original Message ----- > > From: "Tim Hoff" <TimHoff@> > > To: <flexcoders@yahoogroups.com> > > Sent: Monday, July 03, 2006 6:05 AM > > Subject: [flexcoders] Cairngorm2: ViewLocator - ViewHelper > > > > > > I've recently been toying with the concepts of ViewHelper vs. > > ViewLocator. Alex Ulmann posted, "the ViewHelper adds and removes > > itself from the ViewLocator", in his Cairngorm 2 (for Flex 2) - > > Overview and Migration Path. I haven't seen any examples yet that > > illustrate this method. Understandably, the example pool and > > documentation for this kind of thing is small but growing. So, I > was > > wondering if the authors of Cairngorm had any advise/guidance for > this > > topic. Of course it's a matter of scale, but in an enterprise > > application, what is recommended as best practice for the use of > > ViewLocator and/or ViewHelpers? I'm sure that there are > forthcoming > > books that cover this area, but feedback here might promote better > > understanding. > > > > Best regards, > > Tim Hoff > > > > > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: http://www.mail-archive.com/flexcoders% > 40yahoogroups.com > > Yahoo! Groups Links > > > > > > > > > -- > WARNING > ------- > This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender. > > AVIS IMPORTANT > -------------- > Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur. > ------------------------ Yahoo! Groups Sponsor --------------------~--> Something is new at Yahoo! Groups. Check out the enhanced email design. http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/