News for hackers. Stuff that matters.
Re:Simple Ways of Reducing the Cognitive Load in Code by ViktorasM on Tuesday June 28, 2016 @09:55AM (#11993791)
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.

Re:Simple Ways of Reducing the Cognitive Load in Code by loco5niner on Tuesday June 28, 2016 @11:54AM (#11994767)
Honest 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).
Re:Simple Ways of Reducing the Cognitive Load in Code by kentosi on Tuesday June 28, 2016 @02:14PM (#11996110)
I 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.

Re:Simple Ways of Reducing the Cognitive Load in Code by ellyagg on Tuesday June 28, 2016 @01:14PM (#11995516)
Re:Simple Ways of Reducing the Cognitive Load in Code by Roboprog on Tuesday June 28, 2016 @01:34PM (#11995724)
Thank you, thank you. THIS, exactly this.
Re:Simple Ways of Reducing the Cognitive Load in Code by prawks on Tuesday June 28, 2016 @12:23PM (#11995033)
Django'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.

Re:Simple Ways of Reducing the Cognitive Load in Code by amirouche on Tuesday June 28, 2016 @01:41PM (#11995794)
There 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'...
Re:Simple Ways of Reducing the Cognitive Load in Code by macca321 on Tuesday June 28, 2016 @02:20PM (#11996140)
Re:Simple Ways of Reducing the Cognitive Load in Code by 725686 on Tuesday June 28, 2016 @11:13AM (#11994380)
Agree. A few years ago I read this 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-a...
Re:Simple Ways of Reducing the Cognitive Load in Code by greenshackle on Tuesday June 28, 2016 @10:50AM (#11994211)
The 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.
Re:Simple Ways of Reducing the Cognitive Load in Code by amirouche on Tuesday June 28, 2016 @01:42PM (#11995799)
To avoid that Django does split by "app" or feature first.
Re:Simple Ways of Reducing the Cognitive Load in Code by Roboprog on Tuesday June 28, 2016 @01:33PM (#11995717)
Also, 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

Re:Simple Ways of Reducing the Cognitive Load in Code by wodenokoto on Wednesday June 29, 2016 @02:49AM (#11999932)
He 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.
Re:Simple Ways of Reducing the Cognitive Load in Code by jameslk on Wednesday June 29, 2016 @03:50AM (#12000111)
That'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.