New: Define code organization defaults
New Pattern Proposal: Define code organization defaults
Right now, code is mostly organized according to the feature it was developed for.
Since the intent of components is to share behavior, this "feature-based" structure may lead to complex interconnection between features, or "homeless" code that could apply to multiple features.
We should attempt to define a pattern that would apply to most situations.
Advantages of new pattern
- A code organization pattern is a reliable way to house and locate code
- Since we don't have any yet, it may lead to discovering duplicated effort
- A good pattern will also encompass "everything else" which may help clean up scattered files like those in
javascripts/
and overlapping folders likebehaviors
,commons
,entrypoints
,helpers
,lib
, etc.
Disadvantages of new pattern
- A pattern will never be able to encompass every possible situation, so there will always be some outliers
- The danger of choosing a pattern is that while (current) "chaos" is a sort of low-level efficiency drag, a defined pattern may make it extremely difficult for some people whose mental models just don't map the same way, trading distributed chaos across the whole for focused confusion with a few individuals.
What is the impact on our existing codebase?
It's re-organizing, so in product terms, there is none. But it's a lot of moving files around and changing import paths, etc.
Reference implementation
This started when I suggested moving some Code Review tooling / helpers to a higher level, since they're shared and re-used across multiple apps, leading to "Notes" importing things from "Diffs" and vice versa.
That MR is here: gitlab-org/gitlab!128155 (closed)