RobotLegs AS3: A DI Driven MVCS Framework for Flash & Flex – Inspired by PureMVC

RobotLegs AS3Want a framework like PureMVC but without Singletons, Service Locators, or casting? Perhaps one with Dependency Injection and Automatic Mediator Registration?

Well, you might enjoy RobotLegs AS3: yet another lightweight micro-architecture for Rich Internet Applications.

It’s got the bits that I like about PureMVC (Mediators, Commands and Proxies) without any of the bits that I’m not so fond of (Service Locator, Singletons, casting casting casting!).

I’ve put the source up on GitHub, so feel free to Fork it and make it better:

http://github.com/robotlegs/robotlegs-framework

Discussion Group:

http://groups.google.com/group/robotlegs

Here’s a little demo:
(Please note: the API and usage has cleaned up a lot since this demo was built)

RobotLegs Demo App: HelloFlex

You can also view the demo here (with view source).

The demo app is perhaps not so great, but it demonstrates many of the framework’s features. AND, there isn’t a single cast in there! No actor casting, no payload casting, not any casting, not even for fun!

I have much to say about this little framework, but it’s the wrong side of 5am and I’ve had a crazy long day. In the meantime, you can find some background info here and here if you’re interested.

Update: RobotLegs Lives!

Posted in Code, Resources, Robotlegs | Tagged , , , , , , , , , | 37 Comments
  • Pingback: AS3 Dependency Injection and [Autowire] « shaun smith()

  • Pingback: Pijin.net V3 Progress Update - 24 Feb 2009 « shaun smith()

  • Pingback: AS3 Dependency Injection Framework SmartyPantsIOC - Released! « shaun smith()

  • This looks nice, keep up the good work!
    I’m glad you decided not to build on top of PureMVC, and also not to try and do your own IoC framework, one of the things with frameworks like Fabrication is they try to do too much, and don’t decouple themselves from the specific features they are trying to provide. As a result they bloat in size without offering ‘bang for buck’.

  • This looks nice, keep up the good work!
    I’m glad you decided not to build on top of PureMVC, and also not to try and do your own IoC framework, one of the things with frameworks like Fabrication is they try to do too much, and don’t decouple themselves from the specific features they are trying to provide. As a result they bloat in size without offering ‘bang for buck’.

  • Hi Enzuguri,

    Thanks for the feedback. I’ve actually been thinking about abstracting SmartyPants out of the framework code so that other DI/IoC frameworks could be used in it’s place. But that means coming up with some kind of adapter/plugin architecture, and I need to give it some more thought.

    Cheers!

  • Hi Enzuguri,

    Thanks for the feedback. I’ve actually been thinking about abstracting SmartyPants out of the framework code so that other DI/IoC frameworks could be used in it’s place. But that means coming up with some kind of adapter/plugin architecture, and I need to give it some more thought.

    Cheers!

  • Pingback: RobotLegs AS3 v0.2: ReversiblePants « shaun smith()

  • Pingback: Another Architectural Framework, But Why? « shaun smith()

  • Pingback: Constructor Injection vs Setter Injection « shaun smith()

  • Pingback: links for 2009-05-10 | diamondTearz()

  • tom

    Can this be used in non-Flex apps (straight as3)?

  • tom

    Can this be used in non-Flex apps (straight as3)?

  • Hi Tom,

    Yes, RobotLegs can be used for plain ActionScript projects. But not with the Flash IDE (at least, not at the moment). As long as you’re using the free Flex SDK to compile your apps you should be good to go – so, you could use Flash/Flex Builder, FDT, FlashDevelop, Text Mate, or any other tool that uses the free compiler bundled with the SDK.

    This is because RobotLegs currently makes use of SmartyPants-IOC for dependency injection, and SmartyPants is dependent on a couple of Flex classes (but these are bundled into the SWC, hence the ability to compile a plain AS project).

    It might be possible to compile with Flash CS4, but I don’t have a copy of that to test with.

    RobotLegs itself is not dependent on Flex at all, and as soon as I find a nice replacement for SmartyPants I’ll release another version.

    If you’re keen to try it out, and have any problems/questions/suggestions, feel free to drop a message in the discussion group, and I’ll get back to you pronto!

    http://groups.google.com/group/robotlegs

  • Hi Tom,

    Yes, RobotLegs can be used for plain ActionScript projects. But not with the Flash IDE (at least, not at the moment). As long as you’re using the free Flex SDK to compile your apps you should be good to go – so, you could use Flash/Flex Builder, FDT, FlashDevelop, Text Mate, or any other tool that uses the free compiler bundled with the SDK.

    This is because RobotLegs currently makes use of SmartyPants-IOC for dependency injection, and SmartyPants is dependent on a couple of Flex classes (but these are bundled into the SWC, hence the ability to compile a plain AS project).

    It might be possible to compile with Flash CS4, but I don’t have a copy of that to test with.

    RobotLegs itself is not dependent on Flex at all, and as soon as I find a nice replacement for SmartyPants I’ll release another version.

    If you’re keen to try it out, and have any problems/questions/suggestions, feel free to drop a message in the discussion group, and I’ll get back to you pronto!

    http://groups.google.com/group/robotlegs

  • enzuguri :
    This looks nice, keep up the good work!
    I’m glad you decided not to build on top of PureMVC, and also not to try and do your own IoC framework, one of the things with frameworks like Fabrication is they try to do too much, and don’t decouple themselves from the specific features they are trying to provide. As a result they bloat in size without offering ‘bang for buck’.

    Just another Fabrication-user here. Please provide your stats/evidence/experience that Fabrication does indeed “bloat in size”. My experience has been the opposite.

  • enzuguri :
    This looks nice, keep up the good work!
    I’m glad you decided not to build on top of PureMVC, and also not to try and do your own IoC framework, one of the things with frameworks like Fabrication is they try to do too much, and don’t decouple themselves from the specific features they are trying to provide. As a result they bloat in size without offering ‘bang for buck’.

    Just another Fabrication-user here. Please provide your stats/evidence/experience that Fabrication does indeed “bloat in size”. My experience has been the opposite.

  • Hi Gil,

    I’m afraid I can’t really comment on Fabrication itself as I’ve only played around with it briefly, and haven’t built a full application with it. It looks very useful indeed, and I’d probably use it if I had to build another app with PureMVC.

  • Hi Gil,

    I’m afraid I can’t really comment on Fabrication itself as I’ve only played around with it briefly, and haven’t built a full application with it. It looks very useful indeed, and I’d probably use it if I had to build another app with PureMVC.

  • Hi Shaun, RobotLegs looks very promising. Just wanted to let you know that I’m going to take it for a walk in the near future. I watched this Google I/O talk last night which got me inspired about IOC, dependency injection and MVP. Let you know about my findings.

  • Hi Shaun, RobotLegs looks very promising. Just wanted to let you know that I’m going to take it for a walk in the near future. I watched this Google I/O talk last night which got me inspired about IOC, dependency injection and MVP. Let you know about my findings.

  • Hi Gert-Jan, awesome stuff. Will watch that talk soon – have a bit of a back-log of inspiring videos to watch at the moment!

    Let me know how you find RL when you get the chance. The mvcs implementation is based on concepts from PureMVC – ie Mediators as opposed to Presenters – but I’m playing around with some ideas for an MVP implementation.

    Keep me posted,
    Cheers

  • Hi Gert-Jan, awesome stuff. Will watch that talk soon – have a bit of a back-log of inspiring videos to watch at the moment!

    Let me know how you find RL when you get the chance. The mvcs implementation is based on concepts from PureMVC – ie Mediators as opposed to Presenters – but I’m playing around with some ideas for an MVP implementation.

    Keep me posted,
    Cheers

  • Pingback: shaun smith » RobotLegs Updates, Demos and Unit Testing()

  • Pingback: Techwave » Blog Archive » AS3 Dependency Injection Demystified()

  • This looks promising. I like PureMVC for it’s minimalist architecture, but not the boilerplate codes I have to do. And I’m also getting acquainted with DI… and since RobotLegs is based on PMVC, I’m going to take this for a spin in future.

    @Gert-Jan Thanks for the video link!

  • This looks promising. I like PureMVC for it’s minimalist architecture, but not the boilerplate codes I have to do. And I’m also getting acquainted with DI… and since RobotLegs is based on PMVC, I’m going to take this for a spin in future.

    @Gert-Jan Thanks for the video link!

  • You’ve invited comment, and I think that’s important. You’re open to being challenged, that’s more important. I think an ‘opinionated framework’ is really important and its time there was one for Flex (sorry I’m not too interested in flash) that is opinionated and is ready to justify choices based on good design.

    I’d like to see something like the Rails community emerge here. I’m not going to switch from my makeshift, homespun, ‘good enough’ framework, which at least I know well enough, and have established patterns of use internally (to our business).. But if you make something good here, that’s testable, and provable against more than a ‘online pizza order RIA’ (the feeling I get with most RIA frameworks) that free’s up time to contribute back to the project, I (like others) are likely to fall in love. I suspect if Robert is as excited as he is, that this project must be well on its way.

    Time for some screencasts.

  • You’ve invited comment, and I think that’s important. You’re open to being challenged, that’s more important. I think an ‘opinionated framework’ is really important and its time there was one for Flex (sorry I’m not too interested in flash) that is opinionated and is ready to justify choices based on good design.

    I’d like to see something like the Rails community emerge here. I’m not going to switch from my makeshift, homespun, ‘good enough’ framework, which at least I know well enough, and have established patterns of use internally (to our business).. But if you make something good here, that’s testable, and provable against more than a ‘online pizza order RIA’ (the feeling I get with most RIA frameworks) that free’s up time to contribute back to the project, I (like others) are likely to fall in love. I suspect if Robert is as excited as he is, that this project must be well on its way.

    Time for some screencasts.

  • Hi Rasheed, thanks for the thoughtful comment.

    Building a framework for ActionScript akin to what Rails is to Ruby is exactly what I’m hoping will emerge from this experiment.

    The only way to enable that, in my opinion, is to have a core that is well designed and testable – and we’re getting REALLY close I feel!

    Join us over at the discussion group to have your say:

    http://groups.google.com/group/robotlegs

  • Hi Rasheed, thanks for the thoughtful comment.

    Building a framework for ActionScript akin to what Rails is to Ruby is exactly what I’m hoping will emerge from this experiment.

    The only way to enable that, in my opinion, is to have a core that is well designed and testable – and we’re getting REALLY close I feel!

    Join us over at the discussion group to have your say:

    http://groups.google.com/group/robotlegs

  • Hi Shaun,

    This looks really promising. Are you planning on releasing any docs a la PMVC Best Practices. Even a basic UML of the classes and their relationships would be really helpful.

  • Hi Shaun,

    This looks really promising. Are you planning on releasing any docs a la PMVC Best Practices. Even a basic UML of the classes and their relationships would be really helpful.

  • Howdy 1ndivisible, we’re busy putting together some docs over here:

    http://wiki.github.com/robotlegs/robotlegs-framework

    (work in progress)

  • Howdy 1ndivisible, we’re busy putting together some docs over here:

    http://wiki.github.com/robotlegs/robotlegs-framework

    (work in progress)

  • Pingback: Flex and Flash Developer – Jesse Warden dot Kizz-ohm » Blog Archive » How to Use RobotLegs On Top of Gaia: Part 1 of 3 – Quickstart()

  • Pingback: TehKai › AS3 Framework — Gaia()