Working with a large Angular app, I've found it much nicer to split away from the "Rails"-style convention of grouping by type (controllers, models, etc) and instead grouping by modules. This plays especially well with Angular where you can group everything within a module together and include a single module which ties all the dependencies together.
Curious if others do something similar and group code together by modules or does everyone group by type?
I recently spent days writing AngularJS app and I came to same conclusion that I should have split the app into modules.
Even though the style of grouping together Controllers and Services works well, it still won't be easy to maintain when the size of app grows big.
I'm always excited to structure my projects in a different more effective way - well, it's more of a struggle - anyway, this sounds interesting. Can someone elaborate on the file structure and structure of files and the way they connect?
I'm rolling with a MVP structure that frankly is becoming cumbersome with my current project's size.
What I've done myself and found it pretty scalable is as follows:
appShell/
views/allbaseviewshere
viewmodels/controllers or viewmodels for the core views
services/baseservices
moduels/
account
/views/
/viewmodels/
/services/
order
/views/
/viewmodels/
/services/
/controllers/
static
/css/
/js/
/images/
AppShell contains the app starter page, controllers and util services (showing popups, utility functions etc.)
AppShell/Views contains all the UI Skelton for the app (bootstrap main page, etc)
Every folder inside "modules" contains views, controllers (viewmodels) and services belongs to only that module.
Account folder contains views for user registeration, sign in, change user profile, etc. etc.
This way you can keep building new moduels in their respective folders without touching the frozen code (already built modules).
Each module talk to outside world using "services". No module can touch anything belongs to other modules but with "services".
I do it the way you just mentioned. I create specific modules and have them inject their dependencies. Each modules I create has its one or more models within its domain. I was going to go the repository route (one module per type) but it seemed overkill.
For front-end such as Angular I always group in modules, usually nested modules for larger apps. For back-end systems sometimes type makes more sense, especially when the app grows quite big and uses a layered architecture.
Curious if others do something similar and group code together by modules or does everyone group by type?