Think your stuff in MVC!

1 comment

This little post to tell how I’m bored too find good tools but not really well coded or not well structured.
A good example is the AS3 TouchLib library to build multi-touch TUIO applications.This library is a very good idea to translate TCP data from the TUIO server (through FLOSC) to Flash… and it works well.
But when you look to the sources, you can immediately understand the bad MVC knowledge of the developers of that project.
The main controller ( and core classes are inside the flash events package (… strange usage, no?
It should be good to organize a cleaner package, something like this :


The TouchLib library is not the only case.
A lot of developers release stuff and make them public too quickly.
The time spent to organize your project in a good MVC/OOP way will help others to understand it easier and will help you to maintain it correctly.
A framework is not required to do that. You just need to keep a good and coherent structure of your classes.
For my part, I always begin a project by creating empty packages :


During the development, I will create the classes I need to the corresponding package. In that way, I’m sure to keep and good and understandable code for everybody.

Last point : Why AS3 frameworks?

I know I will get some enemies but I need to explain why I don’t like PureMVC, Cairngorm and others:

  • There are good native tools in AS3, often ignored by the developers.
  • Using these frameworks sounds a bit like “re-invent the Life” by using extra classes, interfaces, commands and event dispatchers…
  • The code becomes exaggeratedly split into many classes.
  • Because it’s exaggeratedly split and oppositely to many ideas, you lose a lot of time when someone else has to enter in the project.

There is a good idea of “re-usability” or “maintainability” behind these frameworks but if your project is just well “MVC-minded” they become useless…especially if the main goal of them is to use tools that are already in the Flash or Flex core.
I’m finally thinking that these frameworks are made for(and by) people who ignore how to give a professional structure to their project.

I’m often surprised by the inability or fadeless of some people to simply and correctly use the native AS3 library. And, in many cases, that’s why they use a framework. Sometimes they don’t know how to manage their events properly with native EventDispatcher. Sometimes they forget other native stuff like Event.ADDED_TO_STAGE and Event.REMOVE_FROM_STAGE events to manage things to be killed and cleared from memory. Sometimes they just don’t realize it’s much more quick and simple to create your own controller and its events, a model and the views without a framework layer behind that. Sometimes…

Sometimes I’m so disappointed by the bullshit coming from the mouth of pseudo Certified Flex Developers. They are crazy about frameworks.
One day, a colleague in consultancy to a big client told me : “He came to me to discuss 3hours about the name of a method. ‘GetProductByIdWhenReceivedFromForm1’ or ‘GetProductByIdForm1’. Finally, he chose the second one and he had to refactor lots of classes and re-organize his project.”

First thing, we forced to admit this guy was unable to take a decision, and his faculty to choose a method name is grammatically really bad and counterproductive.  Secondly, wow… 3hours to find a way to recode 40% of your project because your framework madness is killing you from inside…

Hopefully, some of you, pure actionscript programmers, are not like that 🙂

If you do Flex applications, don’t forget Flex is already a framework.
If you do Flash applications, don’t use a framework, just think MVC.

QThink your stuff in MVC!

1 comment

Join the conversation
  • Sakana - February 8, 2010 reply

    Yeah yeah yeah, that’s my Quentin!
    Why reinventing the wheel when “almost” everything is already native.
    So you’re working on multitouch project in flash…can’t wait to see that.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.