I don't see anything wrong with the approach you are taking.  I do 
the same thing (that's probably why I don't see anything wrong with 
it :).  I think of it this way, if the methods you need to add 
directly correspond with the data, and they are ambiguous of any 
commands or other business logic, then the model locator is not a 
bad place for it.  I also add methods to encapsulate the adding, 
removing, and updating of items (when I need to validate the data 
coming or getting updated, standard setter getter type stuff...)

But as someone else said, utility classes are also good.  You just 
have to feel out when you need to do either one.  A utility class 
could be good in this situation because it will save you from 
writing repeating lookup code for each different collection in the 
ModelLocator.

Dustin Mercer

--- In flexcoders@yahoogroups.com, Samúel Jónasson <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> what is the recommended way when many commands need to do perform 
the 
> same action on a model.
> 
> - Do I write the methods in my model?
> - Do I make special commands for this?  If so, how would I call 
these 
> commands from other commands?
> - Do I do this some other way?
> 
> In my case the model is a collection of VO in an ArrayCollection.  
Each 
> of these VO have an ID variable.  Many of my commands get an ID 
> parameter and must be able to locate the VO in the model based on 
this 
> parameter.  So in this particular case I want to write a method 
that 
> takes an ID and returns a reference to a VO in the model. Where 
should 
> this method go?  I realize that the model should be strictly data 
and 
> commands should act on the data. So, commands, model, other? How 
to?
> 
> Best,
> Sammi
>





--
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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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/
 

Reply via email to