The code example fit Mykola's arguments well, which I see as a case
for a component that self contains everything.  The Model, ViewHelper,
and Command for these specific components would never be reused
outside the component it self.  Is there a need for this?  Could be,
but a lot of times Models run across multiple Views hence the need for
more hefty patterns.

For example you have one component that is the form to update a User
(UserFormView), self containing all the ViewHelper, Model, and Command
in the component is much easier then 5 different files.  This is
probably perfectly fine if the UserFormView component is truly self
contained.  But most applications require a lot of reuse and coupling
is not so distinct and sometimes not so predictable.  

Some of the different view points depend on the way the Application
are conceived and developed.  A server business logic driven
application like Mykola's case below might warrant strict self
contained components.  The Use Case driven Cairngorm methodology
creates more robust components that are unaware of each other (excuse
me for my broad statement here).

Where I start to see self contained components break down is where the
Model should be used across multiple Views.  It nice to have a command
setup a Collection of data that is bound across multiple views, and
then to change you logic of when it gets loaded is really simple.  You
dont have to worry about all the places the Collection is used, all
you have to worry about is the asynchronous of the Command call.

I believe there is some room for discussion on the specific uses of
self contained components and maybe some ways of integrating both
ideas into Cairngorm.  Of course with Flex 2 and the Data Services
handling CRUD functions we'll have lots to discuss in the future.

Renaun


--- In flexcoders@yahoogroups.com, Mykola Paliyenko <[EMAIL PROTECTED]>
wrote:
>
> Hi Steven.
> First of all thanks for quick and very substantial reply. I would never
> start this discussion if I had no ideas how to make things better.
Also I
> have already implemented some of them and I'm ready to share this
stuff with
> all of you. However my vision of framework differs from yours I use some
> your classes (Responder and ViewHelper) also I use your FlexUnit
slightly
> patched to support asynch tests. The framework is still raw since I've
> started it only week ago and I am using flex only for 2-3 weeks, but
anyway
> what I'm suggesting is following.
> 
> 1. Use as much generated ActionScript as it is possible
> Since our project is based on the Java and Spring/Hibernate backend
server
> it is to expensive to keep Java interfaces in synch with ActionScript
> manually. That is why good old XDoclet come in handy. For now I'm
generating
> ValueObjects and even Delegates for all our Remote services. It is
not hard
> to implement such code generation the main problem is how to distinguish
> that interface is needed by Flex and that object is ValueObject and
need to
> be generated. I'm using for that our own IValueObject interface and
> java.rmi.Remote respectively. As a result our action script is always in
> synch with server.
> 
> 2. Create functional unit tests to ensure you client work.
> We faced a problem that we have a lot of code that does not work simply
> because it contains no tests. Also Flex IDEs does not always check
the code
> (you can use FDT it checks the AS but does not recognize mxml) and
you may
> commit code that does not compile. All this becomes a hell and can make
> anyone getting test-infected. Also debug in flex is really hell. So
to deal
> with functional tests we have to be able to run asynch tests, to do
it I've
> patched FlexUnit sources a bit and now I'm able to do it, however it is
> still not easy and highly depends on usage. For now I can only test
> delegates but I'm planning to implement full testing (button click -
> [request - asynch response]*N - test what we get). However this will
> requires knowledge on how we handle button clicks (do we use command
> approach or something else).
> 
> 3. No static services
> Since if you use them you need to add their declaration in root
application
> mxml file and also some of them can be reused if you have several
separate
> applications and it makes no sense either to add them all in one file or
> duplicate. For example AuthService is used in all applications, then
I need
> to add it in all Services.mxml for each small application. My opinion is
> that static loading is bad and we can resolve it using mx.rcp.*, I
do not
> use mx:RemoteObject, instead I'm using own ServiceLocator that
creates them
> dynamically. What I get is that the only thing I need to access
something on
> server is to import some delegate and use it I do not care about
> services.mxml any more and it is cool don't you think?
> The only drawback now is that all services are using Java
RemoteObjects over
> http for now but it can be also configured when we need it.
> 
> OK what we get now is very flexible fully generated interface to the
server
> and ability to run tests on it. That was the first step. The next is
event
> routing. I'm not a fun of lots of classes especially when you use script
> language like AS that allows function pointers delegates etc. Lets
use the
> power of language and not cast it to Java. I'm fully realized that
you have
> been impressed by Floyd Marinescu book about J2EE patterns. Yeah
really cool
> book that makes EJB live 2 years longer and I also have used their
command
> pattern, front controller, while developing using EJB in the past.
But now
> we have Spring we have Hibernate, we have agile software
development. World
> become more simple even on the server side level. While client
architecture
> was always simple, Cairngorm is the hardest approach I ever seen. I've
> created own aproach that is based on the JSF managed beans approach. It
> terms of Cairngorm I just mixed Model ViewHelper, commands into
something
> I've also called ViewHelper. Let me show you how does it look like
on the
> simple example (list of the network categories with separate form to
edit
> add or remove selected item. all on the one view)
> 
> So we have a
NetworkCategoryForm.mxml<file:///H:/workspace/sonoportal/webapp/exp/src/com/sonopia/sonoportal/nce/view/NetworkCategoryForm.mxml>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Canvas
>  width="100%"
>  height="100%"
>  xmlns:mx="http://www.macromedia.com/2003/mxml";
>  xmlns:view="com.sonopia.sonoportal.nce.view.*"
>  xmlns="*"
>  creationComplete="networkCategoryViewHelper.init()">//model
initialization
>  <view:NetworkCategoryViewHelper id="networkCategoryViewHelper"/> //
view
> helper creation
> <!-- Grid with the categories-->
>  <mx:DataGrid id="dg"
>  width="400"
>  height="350"
>  dataProvider="{networkCategoryViewHelper.networkCategories}"
>  editable="false" change="networkCategoryViewHelper.selectionChanged(
> dg.selectedIndex);">
>  <mx:columns>
>  <mx:Array>
>  <mx:DataGridColumn columnName="id" headerText="ID" />
>  <mx:DataGridColumn columnName="name" headerText="Name" />
>  </mx:Array>
>  </mx:columns>
>  </mx:DataGrid>
> <!-- Editing form -->
>  <mx:Form x="400" y="2">
>  <mx:FormItem label="ID">
>  <mx:TextInput id="categoryId" width="200" text="{
>
networkCategoryViewHelper.category.id<http://networkCategoryViewHelper.category.id>}"
> />
>  </mx:FormItem>
>  <mx:FormItem label="Name">
>  <mx:TextInput id="name" width="200" text="{
>
networkCategoryViewHelper.category.name<http://networkCategoryViewHelper.category.name>}"
> />
>  </mx:FormItem>
>  <mx:FormItem>
>  <mx:HBox>
> <!-- Buttons with that perform CRUD operations-->
>  <mx:Button label="Update" click="networkCategoryViewHelper.update();"/>
>  <mx:Button label="Add" click="networkCategoryViewHelper.create();"/>
>  <mx:Button label="Delete" click="networkCategoryViewHelper.remove();"/>
>  </mx:HBox>
>  </mx:FormItem>
>  </mx:Form>
> </mx:Canvas>
> 
> and the View Helper
> 
> 
> 
> 
> import com.sonopia.sonoportal.model.network.NetworkCategory;
> import mx.core.Application;
> import org.nevis.cairngorm.view.ViewHelper;
> import com.sonopia.sonoportal.service.network.NetworkCategoryDelegate;
> import com.sonopia.sonoportal.core.business.GenericResponder;
> import org.log4f.logging.Logger;
> /**
>  * @author Mykola Paliyenko
>  */
> class com.sonopia.sonoportal.nce.view.NetworkCategoryViewHelper extends
> ViewHelper{
> //Logger
>  private static var logger:Logger = Logger.getLogger("
> com.sonopia.sonoportal.nce.view.NetworkCategoryViewHelper"); //Model
>  public var networkCategories:Array;
>  public var category:NetworkCategory;
> //function called to init page in a view mode
>  public function init() {
>  loadCategories();
>  view.name.text = "";
>  view.categoryId.text = "";
>  }
> 
>  public function loadCategories() {
>  new NetworkCategoryDelegate(this,
>  function(result) {
> //called on the result, populates the model with list of the
categories from
> the server
>  logger.debug("on loadCategories ", result);
>  this.networkCategories = result;
>  }
>  ).getAllCategories();
>  }
>  public function selectionChanged(selectedIndex:Number) {
>  logger.debug("selected index: " + selectedIndex, this);
>  category = networkCategories[selectedIndex];
>  }
>  public function create() {
>  //TODO validate
>  var item = new NetworkCategory();
>  item.name <http://item.name> = this.view.name.text;
>  logger.debug("adding category");
>  new NetworkCategoryDelegate(
> //here we implement a kind of the anonymous classes in java but using AS
> //function pointers
>  new GenericResponder(this, function(result) {
>  init();
>  })).addCategory(item);
>  }
>  public function remove() {
>  if (category == null) {
>  return;
>  }
>  new NetworkCategoryDelegate(
>  new GenericResponder(this, function(result) {
> //reloading list after deletion
> init();
>  }, function (fault) {
> //handling error if the item is referenced
>  Application.alert("Cannot delete item since it is referenced from
> outside");
>  init();
>  })).deleteCategory(category.id <http://category.id>);
>  }
>  public function update() {
>  if (category == null) {
>  return;
>  }
>  category.name <http://category.name> = this.view.name.text;
>  new NetworkCategoryDelegate(
>  new GenericResponder(this, function(result) {
>  init();
>  })).updateCategory(category);
>  }
> }
> 
> 
> As you can see All I need is 5 methods instead of 5 commands and
> ModelLocator and FrontController. If you say me that 5 commands are more
> transparent I do not agree since almost all commands are dummy they
simply
> call delegate and populate model on result. So why overcomplicate then?
> 
> Regarding i18n, we do need it and all Java MVC has it, also I'm
aware how it
> can be achieved but for me is a question why Macromedia does not
support it
> on the Flex level. But rather than wait we have to implement it as a
part of
> the framework.
> 
> PS. Thanks for everyone that comment this thread, I'll try to continue
> discussion while I'll be moving forward with my approach.
> I'm open for any discussion with anyone, lets make our work easier.
> 
> Have a nice time in Hong Kong.
> 
> Best Regards,
> Mykola
> 
> --
> Mykola Paliyenko
> Senior Software Engineer at Sonopia
> 
> On 11/15/05, Steven Webster <[EMAIL PROTECTED]> wrote:
> >
> >  Mykola,
> >
> > I'm about to head out to MAX in Hong Kong, so will pick up this thread
> > on your return. What I would say is that if you find things are not
> > working for your needs, propose to us how you would alter Cairngorm to
> > make things better, before starting with a blank page. We're very much
> > open to your comments and suggestions.
> >
> > Very briefly:
> 
> 
> 
> 1) Commands
> >
> > I'd like to hear your thoughts in more detail as to why the command
> > pattern is not as effective as anonymous classes ? What do you mean by
> > "lots of dummy commands" ? As an application scales, the command
> > patterns scales well also.
> >
> > 2) Front Controller
> >
> > Again, I don't quite understand your concern. Command manipulates the
> > model, not the view (if you follow the ModelLocator), so command is
> > unaware of the implementation of the view. What do you mean by
> > "accessing something by name" ?
> >
> > 3) Singleton as anti-pattern
> >
> > I just disagree here; that we choose these things to be singletons is
> > *because* we only want a single instance. If you require multiple
> > instances, refactor the singleton to a factory pattern ? Can you give
> > real use-case here as to why you might want to do this, and where
> > current implementation fails you ?
> >
> > 4) Il8n
> >
> > The architectural framework provides a prescriptive framework for
> > architecture, and doesn't choose to implement services in a prescribed
> > manner. There is belief that internationalisation may become a core
> > part of the Flex framework, and Cairngorm elected not to prescribe an
> > implementation until this becomes apparent. In the meantime, there
is a
> > well described implementation by Benoit Hedard that fits within the
> > Cairngorm architecture, but does not rely upon it.
> >
> > 5) No unit-tests
> >
> > Fair point; however, we haven't prescribed mock objects as part of
Flex
> > Unit, or asynchronous tests as part of Flex Unit, but that doesn't
mean
> > they aren't strategies that can be implemented alongside Flex Unit.
> > Irrespective, the lack of prescribed unit-testing strategy is not
to the
> > detriment of using the Cairngorm framework. You can use the Cairngorm
> > framework, and adopt these testing strategies if you see fit. I don't
> > understand this as an argument for or against adopting a
Cairngorm-esque
> > architecture.
> >
> > 6) Single Command Instances
> >
> > We have an internal build of Cairngorm that doesn't have single
command
> > instances, and creates a new instance per command. It's not backward
> > compatible, which is why we chose not to release it as yet.
> >
> > As for "we only use commands to be architecture megaguys and write
lots
> > of lines of code". I assume you're being flippant .... That we choose
> > to use Commands is because we find that it provides a readable and
> > maintanable code-base, that it supports feature-driven
development, that
> > it encourages reuse and promotes refactoring of the code-base, and
that
> > it enables collective code ownership.
> >
> > Command patterns have worked for us on a large number of multi-team
> > projects, and I know it's working for a great number of other
> > developers. If you can propose something that also achieves the above,
> > I'm open to suggestions.
> >
> >
> > Cairngorm is by no means "the true way, the only way", and I
absolutely
> > agree that one could take alternate approaches to implementing a
> > framework microarchitecture. However, I'd welcome that these
approaches
> > be presented as alternatives, with their own justifications for the
> > rationale and motivation behind their particular implementations.
> >
> > Incidentally; Cairngorm *is* open-source; your blog entry suggests
that
> > it isn't ?
> >
> > So; how would you do things differently ? What are the problems that
> > you feel a framework for RIA has to address, what are the forces, and
> > how do you think you might go about your implementation ? Do you agree
> > with the forces and motivations, and dispute their implementation,
or do
> > you believe we are offering solutions to problems that do not exist ?
> >
> > I genuinely look forward to your feedback; however, please excuse
me if
> > I don't reply over the next week.
> >
> > I'll be spreading the Cairngorm-word at MAX Greater China :-D
> >
> > Best,
> >
> > Steven
> >
> >
> > --
> > Steven Webster
> > Practice Director (Rich Internet Applications)
> > Macromedia Consulting EMEA
> >
> > Office: + 44 (0) 131 338 6108
> > Mobile: +44 (0) 7917 428 947
> >
> >
> > > -----Original Message-----
> > > From: flexcoders@yahoogroups.com
> > > [mailto:[EMAIL PROTECTED] On Behalf Of Mykola Paliyenko
> > > Sent: 14 November 2005 17:15
> > > To: flexcoders
> > > Subject: [flexcoders] Cairngorm is bad?
> > >
> > > Dear Flexcoders.
> > > I want to start here discussion about development enterprise
> > > applications using Flex. Our company has choosen Cairngorm as
> > > a framework to do it, but I believe it has some drawbacks My
> > > comments are here:
> > > http://jroller.com/page/mickolka?entry=cairngorm_is_bad
> > > I'm new to Flex but not new to the ActionScript and
> > > JavaScript, also I know lots of Java Web MVC frameworks so I
> > > have a vision about how framework should look like to make
> > > your project succeed.
> > > Thanx for any comments.
> > >
> > > Regards,
> > > Mykola
> > >
> > >
> > >
> > >
> > > ------------------------ Yahoo! Groups Sponsor
> > > --------------------~--> Get Bzzzy! (real tools to help you
> > > find a job). Welcome to the Sweet Life.
> > > http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/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
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >  --
> > 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<http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>
 Computer
> > software
development<http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>
 Software
> > design and
development<http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>
  Macromedia
> >
flex<http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZI36cYzBjw>
 Software
> > development best
practice<http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>
> >  ------------------------------
> > YAHOO! GROUPS LINKS
> >
> >
> >    - Visit your group
"flexcoders<http://groups.yahoo.com/group/flexcoders>"
> >    on the web.
> >     - To unsubscribe from this group, send an email to:
> >   
[EMAIL PROTECTED]<[EMAIL PROTECTED]>
> >     - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >    Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> >  ------------------------------
> >
> 
> 
> 
> --
> Best Regards,
> Mykola
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/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/
 


Reply via email to