Best way to structure your robot legs projects

Joshua Cave's Avatar

Joshua Cave

27 Apr, 2013 03:22 AM

Hi all, Just wanted some best practise advice on how I should structure my robotlegs projects, My project is starting to get bigger and Im wondering about how most people structure their projects.

Im currently seprating everything based on each main view of my application
eg. My app has 5 views
Login View
Job View
Client View
Vehicle View
Worker View

So my structure is as follows

com.cavej03.appName + 
+ Controller
     +  login
     +  worker
     +  client
     +  worker
     +  vehicle
+ Event
     +  login
     +  job
     +  client
     +  worker
     +  vehicle
> Model
     +  etc...
> Service
     +  etc...
> View
     +  etc...
Its somewhat tidy but I still think someone who is looking at my code is gonna freak....

Can anyone recommend common practise, also when i comes to naming commands and events some advice here also..

  1. 1 Posted by Paul Robertson on 27 Apr, 2013 04:54 AM

    Paul Robertson's Avatar

    I started off structuring my apps that way. However, as my projects got
    larger I found that structure to be in need of improvement. My preferred
    structure, taken from posts in these forums, is to actually break it down
    in the opposite way. I first divide packages by "module" (I.e. by what it
    does in the app, such as login, client, worker, etc in your example). Then
    within those packages I place my individual views, commands, events,
    models, etc., each in their own package.

    Paul

  2. 2 Posted by Joshua Cave on 27 Apr, 2013 04:57 AM

    Joshua Cave's Avatar

    Currently doing that exact process.... Thanks for the reply.. First time robotlegs user.. Im loving it... such a cool fun way to program.. makes me feel boss!

  3. Support Staff 3 Posted by Ondina D.F. on 27 Apr, 2013 11:24 AM

    Ondina D.F.'s Avatar

    +1 for Paul’s suggestion

  4. 4 Posted by Joshua Cave on 27 Apr, 2013 11:31 AM

    Joshua Cave's Avatar

    where do you put your events

  5. Support Staff 5 Posted by Ondina D.F. on 27 Apr, 2013 01:22 PM

    Ondina D.F.'s Avatar

    Some people do it like this:

    --controller

    ------commands

    ------events

    --model

    ------vos

    ------events

    --service

    ------events

    --view

    ------events

    Other people do it so:

    --controller

    --events

    --model

    --service

    --view

    I’m putting the events into a single events folder under controller. I find it to be much more clear and easy to find them.

    --loginModule
    ----configs
    --------LoginContext.as
    --------MediatorsConfig.as
    --------ModelsConfig.as
    --------ServicesConfig.as
    --------CommandsConfig.as
    
    ----controllers
    --------commands
    ----------------LoginCommand.as
    --------events
    ----------------LoginEvent.as
    ----------------AnotherEvent.as (just for the sake of an example)
    
    ----models
    --------interfaces
    ----------------ILoginModel.as
    -------- LoginModel.as
    --------vos
    ----------------LoginVO.as
    
    ----services
    -------- interfaces
    ----------------ILoginService.as
    --------RemoteLoginService.as
    --------LocalLoginService.as
    
    ----views
    --------components
    ----------------LoginView.mxml
    ----------------RegisterUserView.mxml
    --------mediators
    ----------------LoginMediator.as
    ----------------RegisterUserMediator.as
    

    Note: I prefer the plural form for my folders’ names, but that's just a personal preference, nothing more. I just think it is important to be consistent, using either singular or plural names for all your folders/packages. Some might say that naming your folders model, view, controller (singular) is the way to go, because it would reflect the MVC pattern. Also, there are numerous articles and discussions on the internet(s!) promoting the singular form for package names for various reasons, some of them being very good. But the dispute about singular vs. plural package-names has not ended yet ;)

    Ondina

  6. Support Staff 6 Posted by creynders on 16 May, 2013 09:36 AM

    creynders's Avatar

    I'm closing this for now, if you have any more questions let us know!

  7. creynders closed this discussion on 16 May, 2013 09:36 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