I think we just wrote about this, though it may have been on a different list. Apparently this is a hot subject lately...

Whether to use a framework or a pattern like MVC really depends on a case-by-case assessment. The whole reason why someone invented design patterns was to address project-specific "design problems". So it makes no sense to say that one specific pattern will address all software architecture needs.

There are dozens of design patterns, each one is best suited to a particular need. MVC, pureMVC, Carngorm, these are all basically MVC patterns with some tweaks.

In general keeping the M the V and C separate make a lot of sense; not just from a clean-code perspective, but also in terms of code-re usability.

Coding in such a way that you promote code re-usability is, IMHO, a really smart way good to go. Encapsulation is far more important than any one particular frame work. Keep the project-specific variables/sprites totally separate from the logic. That way you can re-use the logic again in a future project and accelerate your development speed continually from project to project.

Encapsulation also reduces debugging time considerably -- if you know that an object works, then under similar conditions in a future project it will still work, reducing the areas you need to investigate when debugging. Exceptions, often done following change requests and in quick-fix debugging sessions, are your wizards bane.

So by keeping the actions separate from the data or visual code, you can re-use them easily between projects. And by keeping the visual elements separate, you allow visual classes to be re-usable, same with model classes.

To me, it is this clear separation that provides the real benefit. It creates both clarity in debugging as well as modular code. Nothing is more annoying than finding a class that animates sprites, creates visual elements, loads data and stores it and also defines for each button the same exact action as was in 3 other class files -- if I need to change anything I need to spend precious time hunting where it is and then changing the same lines of code in 3 different places!

The more modular the code, ultimately the faster you can code, which means the more complex your projects can become and the higher your hourly rate can become.

Examples:

If you write an AS3 function that sets up tabs for a navigation, you never have to write than code in AS3 again in any new projects -- encapsulate the whole 'building the nav' logic, and just change the imported assets you need externally to that class and pass it some parameters that relate to dynamic variables [margin between elements etc]: loadNav.load (xmlFile,navButtonSprite,Parameters);

Same with an XML parser, I just have an static method in a custom class I made that I can call, I pass it the function I want it to return to when done loading and voila. Now when I want to load in new XML I never have to write: 'load', 'onload' etc all I write is 'import myCustomXMLloader' and then 'ParseXML.load (xmlFile, callingObject, functionToCallWhenDoneName);'

Same with preloaders, I use a static method which I pass the preloader sprite, image/movie to load and some parameters for position/alignment and it does the rest: 'Preloader.load (asset, preloaderObject, parameters:Object);

Hope this helps,

Seb.

Paul Andrews wrote:
A framework gives you amethod of organising your code in a manner that aids development and maintenance. Using a framework makes your code organisation understandable to others that are familiar with the framework, so it aids cooperative/team development. Potentially you can work on other projects that use the same or similar framework more easily and maybe pick up some coding guidelines/shortcuts and understand the strategies followed by others.

In tiny projects frameworks aren't too important. In larger co-operative projects it is important for the reasons above.

Paul
----- Original Message ----- From: "Joel Stransky" <[EMAIL PROTECTED]>
To: "Flash Coders List" <[email protected]>
Sent: Saturday, November 15, 2008 5:00 PM
Subject: Re: [Flashcoders] frameworks and flash


@ekameleon, that seems a little intense for me atm. This discussion is
mainly about weather or not it's just dumb not to use a framework vs. plain
as3 when building common flash sites. I'm looking to hear things like,
"PureMVC makes everything easier." or "It makes no sense not to use Mate."

On Sat, Nov 15, 2008 at 2:42 AM, Hans Wichman <
[EMAIL PROTECTED]> wrote:

Read the article, some good, some bad.
If anyone declares you for a fool if you prefix interfaces with 'I'
and use marker interface, I tend to gloss over the rest of the article
since it no longer comes across trustworthy... Personal preference
aside:)

On Sat, Nov 15, 2008 at 12:05 AM, David Hershberger
<[EMAIL PROTECTED]> wrote:
> Haha!  Before you try Cairngorm, check out this article:
>
>
http://blog.iconara.net/2008/04/13/architectural-atrocities-part-x-cairngorms-model-locator-pattern/
>
> Having used Cairngorm for a while now I have to agree with him.  The
article
> is pretty harsh, and it only talks about the ModelLocator part.
>
> Dave
>
> On 11/14/08, Joel Stransky <[EMAIL PROTECTED]> wrote:
>>
>> Thanks for the post Dave. Cairngorm sounds a lot like PureMVC which >> does >> away with events and implements a global command structure. So far >> it's >> appealing although my first run in with it was under bad conditions. A >> client of a friend had mangled it something fierce before he was >> brought
in
>> at which point he brought me in to implement deep linking. It was ugly
to
>> say the least. I have however heard great things about it since then. >> My
>> gut
>> says I should know how to do this stuff on my own before I go relying
too
>> heavily on tools that prevent me from getting to know the inner >> workings
>> intimately.
>>
>> It's just tough to esitmate flash/flex work effictively anymore >> without
a
>> framework involved it seems. Clients don't have the time or budget for
>> builds from scratch. Flash used to be so fun but now it's a constant
>> learning curve. ugg.
>>
>> Interestingly enough I looked up the cairngorm site and saw a link to
this
>> blog post made just yesterday:
>> http://www.anandvardhan.com/2008/11/13/popular-flex-frameworks/
>>
>> This should also be informative.
>> http://www.insideria.com/2008/11/new-poll-which-flex-framework.html
>>
>>
>>
>> On Fri, Nov 14, 2008 at 1:52 PM, David Hershberger <
[EMAIL PROTECTED]
>> >wrote:
>>
>>
>> > We have been using Adobe Flex for the past year and have really >> > liked
it.
>> > It would be hard to call it "blazing" and "bloat" does seem like it
might
>> > apply to some extent, but on the other hand it does so many nice
things
>> for
>> > us it is hard to argue with.  MXML is very powerful, but there is
>> certainly
>> > a big learning curve.  For basic stuff, buttons and containers and
text,
>> > it's easy to get started. There are lots of subtle details though, >> > so
>> when
>> > you start wanting to do things in ways the Flex authors didn't
anticipate
>> > it
>> > often takes experimentation to find a way that works.  The Flex
framework
>> > code is open source at least, so you can always dig into that and >> > see
>> what
>> > it's doing.
>> >
>> > We have also used Cairngorm, with mixed results.  Cairngorm doesn't
>> really
>> > give you much code, it is mostly a set of design patterns.  Some of
the
>> > important code it does give is a "controller" which connects >> > Cairngorm >> > Events to Cairngorm Commands. Cairngorm events inherently know >> > their >> > dispatcher, which is a singleton, so you can just fire off events >> > like
>> so:
>> >   new SaveGameEvent(game, user).dispatch();
>> > and the controller connects that to the appropriate
>> SaveGameCommand.  We've
>> > come to the conclusion that Cairngorm is great for situations where
most
>> > user actions imply immediate communications with a server, but not >> > so
>> > useful
>> > for situations where user actions are just manipulating data >> > internal
to
>> > the
>> > .swf.  We have ended up using Cairngorm Events and Commands just on
the
>> > networking side of our app, and for everything else we do more of a
basic
>> > Model/View pattern.
>> >
>> > I don't believe Cairngorm relies on Flex, but Flex gives you "data
>> binding"
>> > which works very nicely with Cairngorm.  Flex data binding lets you
mark
>> > certain state variables with [Bindable] and then the compiler builds >> > data-change events for you. Then your view mxml classes use the >> > data
>> > binding syntax like <Label text="{game.description}"/> and the view
>> updates
>> > automagically whenever the Game's description field changes.  A
Cairngorm
>> > command might query a server and then the server-response-handler in
the
>> > command can set game.description.
>> >
>> > Dave
>> >
>> > On 11/14/08, Joel Stransky <[EMAIL PROTECTED]> wrote:
>> > >
>> > > Hello,
>> > > So I'm trying to nail down a work flow for building flash sites
(read:
>> > not
>> > > flash applications) in as3. I had just about mastered fast seo
friendly
>> > as2
>> > > sites when as3 came out and now that I'm making a concerted effort
to
>> > > modernize my skills I feel like I'm starting from scratch in many
ways.
>> > >
>> > > Enter frameworks. So far I've looked at
>> > > Gaia<http://www.gaiaflashframework.com/index.php>,
>> > > PureMVC <http://puremvc.org/content/view/67/178/>,
>> > > Mate<http://mate.asfusion.com/>and Enterprise
>> > > Architect <http://www.sparxsystems.com/products/ea/index.html>
(please
>> > add
>> > > any others I haven't listed)
>> > > On the upside, I like the idea of rapid development and reduced
>> monotony.
>> > > But the most important thing to me is extremely lightweight >> > > blazing
>> fast
>> > > flash using the least amount of bloat. In a perfect scenario, I
don't
>> > want
>> > > extra file size due to wrappers of core commands.
>> > >
>> > > So, assuming I'm comfortable with the file size/rapid development
trade
>> > off
>> > > with one of these packages, my concern then becomes one of
dependency
>> and
>> > > learning curve. After learning a new API, am I going to have to >> > > hack
or
>> > > work
>> > > around it for those interesting situations that always seem to pop
up?
>> > What
>> > > if something major changes on the flashplayer and my chosen
framework
>> > > doesn't address it? I fear becoming too dependent on a 3rd party
api.
>> > >
>> > > I'd really like to know what you guys are using, any development
horror
>> > > stories you have because of it as well as any insight you can
provide
>> > about
>> > > the concerns I've listed.
>> > >
>> > > Thanks for your time.
>> > >
>> > > --
>> > > --Joel Stransky
>> > > stranskydesign.com
>> > > _______________________________________________
>> > > Flashcoders mailing list
>> > > [email protected]
>> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> > >
>> > _______________________________________________
>> > Flashcoders mailing list
>> > [email protected]
>> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>> >
>>
>>
>>
>>
>> --
>>
>> --Joel Stransky
>> stranskydesign.com
>> _______________________________________________
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




--
--Joel Stransky
stranskydesign.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to