Rationale
GitLab follows modular code principles. Modules must have clear boundaries, single responsibility, and minimal coupling.
Requirements
- Each module must have a single, well-defined responsibility
- Module dependencies must point inward (Dependency Inversion)
- Cross-module communication must use defined interfaces
- No circular dependencies between modules
- Module internals must not be exposed to other modules
Module Structure
module/
├── src/
│ ├── main/
│ │ ├── api/ ← Public interfaces only
│ │ └── internal/ ← Implementation details
│ └── test/
└── README.md
Modularity Rules
| Rule | Description |
|---|---|
| SRP | Each module has one reason to change |
| ISP | Interface Segregation — small, focused interfaces |
| DIP | Depend on abstractions, not concretions |
| CCP | Common Closure Principle — changes affect one module |
| CRP | Common Reuse Principle — modules reused together |
References
- Modular Code Guiding Principle: https://handbook.gitlab.com/handbook/engineering/development/growth/modular_code/
- Key Abstractions: https://handbook.gitlab.com/handbook/engineering/architecture/abstractions/