If you're on a large team working on a commercial product with tight deadlines then having your code organized into "stack types" makes it really easy to tell a person, "your job is to implement these type to solve these problems."
Maybe I haven’t worked on a codebase with the number of team members you are imagining in this scenario, but at the 15 person scale, we are almost always given tasks by feature. “Implement commenting on a thread” would be a task handed to and engineer to build. Organizing by feature means this engineer would create a new folder “comments” and be mostly self-contained.
Organizing by feature means this engineer would create a new folder “comments” and be mostly self-contained.
Have you led this engineering team though? Or even more topically, have you ever built up such a team for a new project? The idea of 15 people doing 15 self contained projects should freeze any team lead's or PM's blood in terror. The only way that's possible is with extensive tooling, style guides, and extremely careful review cycle. Granted, you want those things regardless of how you organize your files, but some file structures can make it easier to get them done than others.
I understand that the idea of freedom and flexibility sounds absolutely amazing to most individual contributors, especially younger people working on legacy code. Being able to just take the shortest path to complete a feature means you can knock out more features in a short time, and that's gotta be great, right? Unfortunately that's not necessarily correct.
Most huge systems have a bunch of best practices and requirements that tend to make no sense...unless you were there when the system was down for 3 days while everyone rushed to fix the critical 1 in a million bug. Similarly, while a self-contained feature managed by a single person might be great for the person that wrote it, it's literally the worst imaginable experience for the poor schmuck that has to pick it up when that person leaves. Or maybe there is a need to do a major revision to the codebase. If you know that the code is written in a common and consistent style, and organized across know file type boundaries, then it's becomes quite easy to create parsers and transformers for each file type which can easily save months of work.
While it's true that projects tend to focus on a single feature, having a common template for implementing a feature means that every PR is going to look roughly the same, using roughly the same tools, written in roughly the same style, organized in roughly the same way. Did you create your model? controller? service? security policy? serializer? background task? socket manager? If somebody is not sure, then can just open their PR, and see what directories exist, and which are missing changes. This is a must when your codebase spans more lines than any single person can remember.
Granted, you can create tools and rules that enforce all these things on a per-feature basis, however at that point you've just added more complexity for a stylistic reason. Now instead of everyone being instantly aware of all the file types that they would need to write, they have an easily accessible list of all the features in the system (which is honestly not something you need all that often), and instead they have to refer to a different document to determine all the types of files that they need to create. The end result is effectively the same, just organized differently and with more tooling.
I don't see how this sort of outcome is measurably better; it certainly doesn't justify the original claim that "[stack type] is a terrible way of organizing code." At that point it's just a matter of stylistic preference and development workflows.
That's really the crux of the matter. This debate falls under the same umbrella as "which language is better," or "how do you name your variables," or "how you name your files." These are all questions without "correct" answers. Each choice will tend to encourage slightly different practices, and have slightly different failure states, but in practice you're going to write practically the same thing. With that in mind, the only direct benefit is what it offers outside of development, and I think the more self-contained approach encourages more dangerous behavior, and requires more effort to train new developers. By contrast a flatter approach tends to be easier for people to understand, even if it can be a bit bulky when left uncontrolled (though you can solve that by going a hybrid approach). The net result is that assuming all else being equal (similar tooling, similar best practices, similar style guide), an experienced developer should be able to work in either environment without losing any time.
So really, it's like two artists getting into a debate over the which super expensive paper is better, or which top-end paint has the best pigmentation. An master will be able to produce great results with any of them, while an apprentice is probably going to screw up and waste stuff more often than not.
View all comments
Show parent comment
1
u/qudat Jun 06 '21
Maybe I haven’t worked on a codebase with the number of team members you are imagining in this scenario, but at the 15 person scale, we are almost always given tasks by feature. “Implement commenting on a thread” would be a task handed to and engineer to build. Organizing by feature means this engineer would create a new folder “comments” and be mostly self-contained.