RL or not RL to build components?

jadd's Avatar

jadd

11 Nov, 2010 04:49 PM

I guess I'm walking backwards (like a prawn!).
I'm not new to RL, I did and I do "my little things" with it but now I'm feeling quite confused expecially after reading today this (closed) discussion:

http://knowledge.robotlegs.org/discussions/questions/275-robotlegs-....

In the first comment Shaun says:

"In general though, I wouldn't recommend building a video player with Robotlegs, I'd build the player as a self-contained component. Frameworks like RL are used to wire components together into applications, not really to build those components - it's best to keep "framework/application" code out of your components. You might use RL to build a video player, but only if that was the entire app - some kind of super advanced stand-alone video playing application.
I'm not saying that you can't use RL to build a component, but rather that using an "application framework" to build a component is often overkill. Of course, the line between "component" and "application" depends completely on the project at hand."

All the code I wrote using RL is just the opposite!! I used RL to write "components" (Slideview, Gallery, Navigation and even a "generic" Loader) and it's the only part of my code I'm sure and well structured thanks to RL.

The first of many questions is: Do I not understand anything of RL?

Thanks.
Roberto.

  1. 1 Posted by Stray on 11 Nov, 2010 05:07 PM

    Stray's Avatar

    Hi Roberto - don't panic!

    If your components are chunky enough then it's understandable that you'd use RL to write them. I think I write stuff bordering on components in RL myself. After all - where does a component become a mini-application?

    If we imagine that a 'component' could be anything from a textlabel to an xml-driven gallery - there is going to be a point in there where it's worth throwing RL in. I don't think you've done anything wrong in using RL to build what you have - especially if it has helped your code stay well structured!

    There is no hard a fast rule, and as Shaun says - there right technology depends on the project at hand.

    For me there are 2 good questions to ask when deciding whether to include robotlegs inside a 'component':

    1) Does the 'component' need to be viable outside of the current project and highly portable?

    - If the answer to this is yes then think carefully before tying it to the framework.

    2) Does the 'component' need to make use of the command map, mediator map and injector mappings?

    - If the answer to this is no then you could probably do something simpler - for example just use the sharedEventDispatcher approach and the eventMap (it's surprisingly easy to use parts of the RL framework on their own by providing their dependencies manually).

    It's also oddly easy to rework written with robotlegs to remove the framework if you need to refactor it out later - if you've used the conventional MVCS approach and not injected into views and stuff anyway.

    The difficulty can potentially come with version clashes between the RL framework in your components and the framework of the whole app. These should be minor but it's worth thinking about if you're packaging as swc - check your component against the various versions of RL to find out which is the minimum version that works.

    I hope this helps,

    Stray

  2. 2 Posted by jadd on 11 Nov, 2010 05:44 PM

    jadd's Avatar

    Thank Stray for your help and most of all for the "encouragement". Thank to some god I'm not at least in the wrong path!.

  3. jadd closed this discussion on 15 Nov, 2010 09:32 AM.

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

Keyboard shortcuts

Generic

? 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