Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curious about rational behind "bootstrap". #2

Open
howardroark opened this issue Jul 30, 2015 · 2 comments
Open

Curious about rational behind "bootstrap". #2

howardroark opened this issue Jul 30, 2015 · 2 comments

Comments

@howardroark
Copy link

Hey @creynders !

I find I learn better by understanding the logic behind certain decisions. I really want to work from your example but I need a bit more context about certain things. I thought I would see if you might be willing to humour me :P

        this.wireCommands( {
            'app:bootstrap:requested' : [
                require( './controllers/BootstrapI18N' ),
                require( './controllers/BootstrapDomain' ),
                require( './controllers/StartRouter')
            ],
            'SetupI18N:execution:completed': [
                require( './controllers/BootstrapUI' )
            ]
        } );
  1. What is the rational behind naming the wired command app:bootstrap:requested... the requested part maybe more-so.
  2. What is the rational behind the isolated BootstrapDomain controller and what is Domain to you?
  3. Would you always recommend having a completed command that is triggered by requested?

Thanks!!!

@creynders
Copy link
Contributor

@howardroark hi there, sorry for the long wait, I was away on holidays.

  1. I find naming events real hard, so I try to stick to a specific format, roughly being sender:action:state or sender:subject:state. Since that's what events basically are: state change signals. The instances where I use requested is when an objects state depends on (an) external action(s)/data, i.e. it needs something which is inherent to the object, yet is provided by an agent.
  2. To me domain are the models, collections and services necessary to perform domain logic, i.e. regardless of how that data is stored. I'm not too strict about it though, since with Backbone models have easy localstorage and REST API communication baked in.
  3. No, not necessarily. One of the things with events that goes wrong really quickly is that you easily start creating implicit dependencies. For instance: a model which sends out a "loadOtherModel" event instead of a "thisModelDataReady", i.e. implicitly you write down the load order inside unrelated models (just an example obviously) So, to come back to your question, a model:data:requested chain can be finalized by a command responding to a specificService:load:completed. If there are any other actors that need to know when the model's data is ready, then it will dispatch a model:data:completed, otherwise not.

@howardroark
Copy link
Author

Thanks for the great explanation! So if the views depended on multiple models and remote data sources in order to render correctly would you fetch them within BootstrapDomain?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants