Organise files by function Good or Bad?

I read this blog post today:

http://cliffmeyers.com/blog/2013/4/21/code-organization-angularjs-javascript

The author suggested a different approach to structuring Angular apps that also applies to Ember. Break up section by functionality as opposed to category.

So, place your controller/models/routes/views/templates for a particular area in one folder.

Have any people experimented with this kind of file structure? Is it a good or bad idea?

1 Like

I have not tried this approach, but seems to be a good idea considering that one resource may have more than one functionality/scenario. I have a large number of files and I think this approach would definitely help me to navigate better through them in debug mode.

I never navigate trees using my UI, just using cmd + t. So changing this wouldn’t directly affect me. However, I have a couple of lingering doubts:

What about components that have no functional area? For example a category model. Would that go in topic or list or its own section?

Another issue: I really like about how Discourse organizes js files is it is congruent to Rails. It is basically the same tree – models, controllers, views, templates. Is okay to have the client side app not match the same structure as the server side app?