Your folder structure has two jobs, but only does one
5 hours ago
- Folder structures serve two distinct jobs: finding files and placing files, and these jobs have different optimization criteria.
- Placement mistakes compound over time, as misclassification becomes a convention, while navigation mistakes incur only a one-time cost per developer per file.
- Role-based structures (e.g., organizing by UI role like forms/, modals/) excel at finding but create fuzzy edges and catch-all folders like shared/, leading to placement ambiguity.
- Layer-based structures (e.g., CE Pattern: core, elements, patterns) use a mechanical rule based on dependency count, making placement unambiguous but naming less intuitive for navigation.
- The CE Pattern defines core as unmodified vendor components, elements as enriched variants, and patterns as composed combinations with strict downward-only dependencies.
- Choosing between role-based and layer-based depends on context: cross-functional teams or small codebases favor role-based, while growing codebases benefit from layer-based to avoid costly refactoring.
- AI tools can assist with exploration but cannot replace thoughtful design; default to deterministic rules over familiar taxonomies when in doubt.