New to MVC, new to Robotlegs, please help

Steve's Avatar


19 Feb, 2012 08:18 PM

So I have a self project where I have decided to force myself to learn Robotlegs.

I have been developing in actionscript for over 7 years. My problem is not my ability to code, my problem is that I have never taken the time to learn MVC. I'm finding that as I work my way through teaching myself Robotlegs, I am clearly at a disadvantage due to my lack of knowledge of MVC.

I don't really know the right question to ask, because I feel like the only answer you can give me is "go read this tutorial". Here's the thing... I understand these tutorials. I understand the robotlegs examples.

What I do not understand is... quite simply: Why MVC? What benefit do I propose by building my actionscript project using MVC/Robotlegs?

Please point me in the right direction.


  1. 1 Posted by Steve on 19 Feb, 2012 11:46 PM

    Steve's Avatar

    If possible, would anyone be willing to walk me through setting up my project to work with RobotLegs? I don't need hand holding. I know how to code, and I do it well. I just feel like once I understand the concept of MVC, it will literally be an ENORMOUS weight off of my shoulders.

  2. Support Staff 2 Posted by creynders on 20 Feb, 2012 08:29 AM

    creynders's Avatar

    It's one of those concepts that only starts to make sense when you're dealing with larger applications and/or when working on the same application with several developers, that's why it's a bit hard to grasp when reading tutorials. The tutorials are kept small and easy in order to clearly communicate the concept itself, but obviously the motivation for using the methodology remains a bit vague then.

    Compare it with tasks, if you've got 3 tasks that need to be done on a certain date, you won't feel the need to have some kind of task organization, but if you have to deal with dozens of different tasks, with various due dates you'll start using todo-lists. Then when you start working with a team of people and you need to prioritize and sequence tasks, you realize simple todo-lists won't suffice and you'll end up with applying SCRUM for instance (it obviously deals with more than task management, but it is one of the core parts of the methodology)

    The same applies to MVC. It's benefits are absolutely not restricted to large-scale, team-based development, but they become most obvious in such situations.

    Let's say you need to make a web application that loads some data in a xml file, lets the user do some operations on that data and saves the users edits in a SharedObject.
    Fine. It's a small application, you can develop it pretty fast and there's no need to start thinking about using MVC or other patterns for structuring your components (not talking about UI components here, just cogs in the machine).
    The application is a huge success and your client is extremely satisfied, they ask you to change the application because they'll be setting up a back end with which the xml file can be manipulated by them, in fact no, they want to use a database instead of the file. And since it's 2012 they definitely need an iphone app as well.
    You'll start working on the web application and since the deadline's not just tight, but completely insane chances are you'll be modifying it to reflect the use case changes, make a copy of the entire project to create the iphone app and again simply making the iOS required changes in that project directly.
    Now repeat this five times. The client keeps on asking modifications. expansions etc. These can be UI related changes, but even complete backend architecture swaps, going from REST to SOAP for instance.
    If you didn't structure your project using MVC, you'll be in a world of pain. No, you'll be in a world of pain anyway, but had you used MVC from the start you'd notice that some things would've been less painful:

    • 95% of the code for the web application and the iphone app will be the same, but instead of saving the user data to a Shared Object or through a web service, you'd be using a local DB for instance. Due to the separation of concerns as promoted with MVC (and even more specifically with RL) you'd notice that the only thing different in the web app and the iphone app would've been a single service class. Without MVC chances are pretty high you'll be making modifications in a bunch of classes.

    • The same applies to the UI for instance. Again, the heart of the application is the same, only the way it's presented to the user is different. Due to separation of your app into the various tiers you'll notice that changing the UI for the iphone app, will only have an impact on view classes and you'll spent a tremendous amount of time less of searching through your code and finding out where to change what.

    • w/o MVC 95% of both apps would still be the same, but the differences would've been scattered in various files, here and there some lines, with MVC the differences will be in using different classes, ie the changes are more compact and overseeable.

    All in all using MVC makes your code more structured and far more flexible to accomodate change in size, platform etc. etc.

    There's more, but I've run out of time, hope to come back to this soon.

  3. 3 Posted by Abel de Beer on 20 Feb, 2012 09:26 AM

    Abel de Beer's Avatar

    Almost two years ago I wrote a paper for school, called "Is MVC for me?". Reading it now, there are a lot of ways it could be improved, but I think it might still be interesting anyway. It initially focuses on PureMVC, a framework Robotlegs borrows a lot of its concepts from, and makes a (rather small) comparison with Robotlegs:

  4. Support Staff 4 Posted by Till Schneidere... on 20 Feb, 2012 03:10 PM

    Till Schneidereit's Avatar

    In addition to the excellent information Camille and Abel already
    gave, you might be interested in picking up Stray's book on Robotlegs:

    It's a great introduction into both the framework as well as the goals
    behind it.

  5. Ondina D.F. closed this discussion on 08 Mar, 2012 09:20 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac