[go: up one dir, main page]

Skip to content

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

  1. A code organization pattern is a reliable way to house and locate code
  2. Since we don't have any yet, it may lead to discovering duplicated effort
  3. A good pattern will also encompass "everything else" which may help clean up scattered files like those in javascripts/ and overlapping folders like behaviors, commons, entrypoints, helpers, lib, etc.

Disadvantages of new pattern

  1. A pattern will never be able to encompass every possible situation, so there will always be some outliers
  2. 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)