Just looking to see if I'm on the right track...

mdw1980's Avatar

mdw1980

15 Dec, 2009 11:36 PM

Howdy. Decided to give Robotlegs a go today and wrote a really simple RSS loader/viewer. I've attached it to this post and was curious if anyone might have a spare minute to look it over and let me know if I'm on the right track. If I do happen to be on the right track, have a go at what I could perhaps do better. Thanks.

  1. 1 Posted by levi.strope on 16 Dec, 2009 03:24 PM

    levi.strope's Avatar

    I didn't run it, but I took a look at the code, and I think you're definitely on the right track.

    My only comments would be:
    1 - It's very clean and neat.
    2 - In you're context you don't need to provide the constructor. Not really a critique. I just thought it might as well not be there.. That is unless you are switching the auto startup property occasionally.
    3 - You could omit the entire startup command/event sequence and just do your mappings in the context's startup command, but I like you're technique :)

    Looks good to me!

  2. 2 Posted by mdw1980 on 16 Dec, 2009 03:30 PM

    mdw1980's Avatar

    If you don't provide the constructor in the context you get a compile time error:

    Error: Incorrect number of arguments. Expected 0.

    Thanks for the comments.

  3. 3 Posted by levi.strope on 16 Dec, 2009 03:56 PM

    levi.strope's Avatar

    This runs for me. What version of the framework are you using?

    // Imports have been cut out for brevity
    
    package com.mailsettings.contexts
    {
    
    public class MailModuleContext extends Context
    {
    
        override public function startup():void
        {
    
         //model
           injector.mapSingleton(MailSettingsModel);
    
         //View
           mediatorMap.mapView(contextView, MailModuleMediator, MailSettingsModule);
    
         //Controllers
           commandMap.mapEvent(DomainEmailEvent.QUERY_DOMAIN_EMAIL, QueryDomainEmailCommand);
           commandMap.mapEvent(EmailAccountEvent.ADD_EMAIL_ACCOUNT, AddEmailAccountCommand);
           commandMap.mapEvent(EmailAccountEvent.EDIT_EMAIL_ACCOUNT, EditEmailAccountCommand);
           commandMap.mapEvent(EmailAccountEvent.DELETE_EMAIL_ACCOUNT, DeleteEmailAccountCommand);
    
         //services
           injector.mapSingletonOf(IEmailService, EmailService);
    
        }
    }
        }
    
  4. 4 Posted by mdw1980 on 16 Dec, 2009 04:06 PM

    mdw1980's Avatar

    Odd. I'm using 1.0.1 as seen by the swc file in the lib folder.

  5. 5 Posted by Andrei TT on 29 Dec, 2009 07:22 PM

    Andrei TT's Avatar

    I took a look at your code and it's nice and clean, good work.

    @levi I always leave the constructor on my context, but that's because of my laziness to delete it. Don't know why you shouldn't have it, it's not getting in the way. Also, yeah, i like to do my mappings in the context and skip the whole startup command/event thing.

  6. Stray closed this discussion on 11 Feb, 2011 11:25 PM.

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