6 ms·
Stopped reading at "Place models, views and controllers in their own folders". No worse way to organize your code than classify by behavior type. "Here are all
by ViktorasM 10y ago
Stopped reading at "Place models, views and controllers in their own folders". No worse way to organize your code than classify by behavior type. "Here are all the daos", "here is all business logic", "here are all the controllers". You add a feature as small as resource CRUD and scatter it's pieces across the whole code base.
No.
- greenshackle 10y agoThe guidelines for a framework I use is to put views and models in separate folders. Which means code for any model is spread out between at least two folders. Finding code is annoying.
- amirouche 10y agoTo avoid that Django does split by "app" or feature first.
- 725686 10y agoAgree. A few years ago I read this http://olivergierke.de/2013/01/whoops-where-did-my-architecture-go/ http://olivergierke.de/2013/01/whoops-where-did-my-architect... post which made a lot of sense to me. Also this: http://www.slideshare.net/olivergierke/whoops-where-did-my-architecture-go-11678054 http://www.slideshare.net/olivergierke/whoops-where-did-my-a...
- loco5niner 10y agoHonest question from someone with little real world experience outside .Net: This is MVC's convention, to "Place models, views and controllers in their own folders", and it's what I'm used to working with. Can you point me to resources outlining other methods (responding with google "XYZ" would be fine too).
- prawks 10y agoDjango's recommended project structure is one that immediately comes to mind. A project is broken down into "applications" each which have their own models, views, and controllers (among other things like forms, tests, etc.). Each "application" is an area of responsibility within the project, like payment or user management. As it's python, the 'views' module could technically be a folder with multiple files inside it, but they would all be grouped under their respective app.
- amirouche 10y agoThere several reasons to create a folder. The question is simplistic to me if the folder describe a `model' I call it model. If it describe a feature like "cart" I call it... `cart'...
- ellyagg 10y agoOrganize projects by feature: http://jaysoo.ca/2016/02/28/organizing-redux-application/ http://jaysoo.ca/2016/02/28/organizing-redux-application/
- Roboprog 10y agoThank you, thank you. THIS, exactly this.
- kentosi 10y agoI believe it's called vertical packaging. Package "employee" contains: EmployeeDto, EmployeeService, EmployeeController Package "order" contains: OrderDto, OrderService, OrderController And so on. This way logic that is closely related is kept closeby.
- macca321 10y agoA .NET take on it https://lostechies.com/jimmybogard/2015/07/02/ndc-talk-on-solid-in-slices-not-layers-video-online/ https://lostechies.com/jimmybogard/2015/07/02/ndc-talk-on-so...
- Roboprog 10y agoAlso, be sure to repeat adjectives and other name parts as much as possible. Ideally, the same names could be used in the directory/package, file/class, function/method and variable names. Never let the reader forget that this is smurfView or batController or whatever. /sarcasm
- wodenokoto 10y agoHe doesn't advocate MVC. He says you should use whatever paradigm your team decides on, and if it happens to be MVC, then you should follow that paradigm and not scatter the M's, the V's and the C's all around.
- jameslk 10y agoThat's not what the OP is getting at. He's referring to the common file organization of projects where, for example, in MVC, the models are located under a models directory, the controllers under a controllers directory and the views under a views directory. If I want to understand what the code does, looking over the code and seeing just a bunch of models or controllers is next to useless. Instead, the code should be organized semantically by the domains of the application. I should be able to look over the various directories and files and have a high level understanding of what the application does, not that it's just another MVC application. This semantic organization also promotes encapsulation since only things related to each other are near each other, instead of scattered throughout many directories organized by arbitrary architectural concepts.