Skip to content

Architecture: two shallow modules fail the deletion test — consider inlining into single callers #76

@heyitsStylez

Description

@heyitsStylez

Problem

Two small modules are extracted into their own files but don't earn their depth — they just move code around without concentrating complexity.

05c-outcome-distribution.js (32 lines)

  • Only caller: 06a-render-outcome-chart.js
  • Deletion test: removing it means inlining a 12-line reduce loop into the chart renderer. Complexity disperses slightly but doesn't concentrate anywhere.

05d-calc-stats.js

  • Small aggregation function; single primary consumer in 07-render-charts.js
  • Deletion test: same result — the caller would inline the aggregation without meaningful added complexity

These modules require a context switch (open a new file, load its definitions) to understand logic that reads naturally inline next to the code that uses it.

Files involved

  • src/js/05c-outcome-distribution.js
  • src/js/05d-calc-stats.js
  • src/js/06a-render-outcome-chart.js
  • src/js/07-render-charts.js

Proposed solution

Two options:

  1. Inline — move the logic into the single caller; delete the files
  2. Document as domain formulas — if the computation is considered stable domain logic worth naming (e.g. "Outcome Distribution" is a concept in CONTEXT.md), keep the file but add a comment pointing to the domain definition so the context switch has payoff

Benefits

  • Fewer files to bounce between when reading the render path
  • Outcome distribution logic lives next to the chart that uses it
  • Reduces module count without losing any domain knowledge

Note

This is lower priority than the other architecture issues in this batch — it's a tidying opportunity, not a structural problem.

Category

Deepening opportunity — architecture review

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageMaintainer needs to evaluate this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions