javascript - Project organization and naming conventions -


this follow-up repeating module name each module component question.

we've decided follow suggested in best practice recommendations angular app structure blog post angular project organization , naming conventions while building small internal application measuring connection quality.

and we've got @ moment:

$ tree -l 1 . ├── app-config-service.js ├── app-config-service_test.js ├── app-connection-service.js ├── app-connection-service_test.js ├── app-controller.js ├── app-controller_test.js ├── app-countdown-directive.js ├── app-countdown-directive_test.js ├── app-footer-directive.js ├── app-footer-directive_test.js ├── app-footer-service.js ├── app-footer-service_test.js ├── app-math-service.js ├── app-math-service_test.js ├── app-stats-directive.js ├── app-stats-directive_test.js ├── app-status-directive.js ├── app-status-directive_test.js ├── app-status-service.js ├── app-status-service_test.js ├── app-time-directive.js ├── app-time-directive_test.js ├── app.css ├── app.js ├── bower_components ├── config.json ├── countdown.html ├── footer.html ├── img ├── index.html ├── ping ├── stats.html └── status.html 

as can see, there several directives, services, partials, single controller, module declaration file , couple config , app-specific unrelated topic files. becomes mess of files , not quite readable , easy work with.

this because we have 1 single module , keep inside it.

is okay use old component-oriented approach , have special directories services, controllers, directives , partials such simple app? mean new "organized feature" approach work non-trivial huge applications?

you decided "follow suggested in best practice recommendations angular app structure blog post", don't seem have followed it...


according recommended approach, each component/feature should in own directory (under components directory).

for reasons pointed out gil birman , detailed in aforementioned blog post in repeating module name each module component, makes more sense organize directories feature (e.g. foo-feature directory contains directives, services, controllers, partials etc related feature) organizing type (e.g. controllers in 1 directory, services in another) etc.


in case, above guidelines (more way of thinking) , not precise recipe or deterministic algorithm can decide place each file (e.g. there going components/lib/ directory, service go inside feature's directory or under components/common/ directory etc).
need understand guidelines (and purpose/need trying fulfil) , develop convention suits team's style.

there times when won't sure place file. can have debate team, make decision , go that. totally normal (especially @ first), you'll find out time goes by, such cases arise more , more rarely.


that said, expect directory , file structure more (making assumptions services might more generic/utility-like):

app/ |___ app.css |___ app.js |___ app-controller.js |___ app-controller_test.js |___ bower_components |___ config.json |___ index.html | |___ components/ |    |___ common/ or util/ |    |    |___ config-service.js |    |    |___ config-service_test.js |    |    |___ connection-service.js |    |    |___ connection-service_test.js |    |    |___ math-service.js |    |    |___ math-service_test.js |    | |    |___ countdown/ |    |    |___ countdown.html |    |    |___ countdown-directive.js |    |    |___ countdown-directive_test.js |    |  |    |___ footer/ |    |    |___ footer.html |    |    |___ footer-directive.js |    |    |___ footer-directive_test.js |    |    |___ footer-service.js |    |    |___ footer-service_test.js |    | |    |___ img/ |    |    |___ ... |    | |    |___ stats/ |    |    |___ stats.html |    |    |___ stats-directive.js |    |    |___ stats-directive_test.js |    |  |    |___ status/ |    |    |___ status.html |    |    |___ status-directive.js |    |    |___ status-directive_test.js |    |    |___ status-service.js |    |    |___ status-service_test.js |    | |    |___ time/ |         |___ time-directive.js |         |___ time-directive_test.js | |___ misc/      |___ ping 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -