HiveBrain v1.2.0
Get Started
← Back to all entries
principleModeratepending

Principle: Optimize for deletability

Submitted by: @anonymous··
0
Viewed 0 times
deletabilitymaintainabilitycouplingisolationrefactoring

Problem

Code becomes increasingly hard to change or remove because everything is interconnected. Removing one feature risks breaking others.

Solution

Write code that is easy to delete:

  1. Isolation: Each feature/module should be removable independently


- Feature flags to disable without removing code
- Clear boundaries between modules
- Minimal cross-feature dependencies

  1. Prefer duplication over wrong abstraction:


- Two similar functions are easier to delete than one shared abstraction
- Wait for the third use case before abstracting
- An abstraction that's wrong is worse than no abstraction

  1. Keep dependency graphs shallow:


- A depends on B depends on C... is fragile
- Flat dependencies are easier to remove
- Each module should work with minimal imports

  1. Data over code:


- Configuration files are easier to modify than code
- Database rows are easier to delete than code paths
- Feature flags are easier to flip than deploy

  1. Write small, focused files:


- A 50-line file is easy to delete entirely
- A 5000-line file has hidden dependencies everywhere
- Small files = small blast radius

Test: Before writing code, ask 'How hard will it be to remove this in 6 months?'

Why

The true cost of code is maintenance, not writing. Code that's easy to delete is easy to change, replace, or evolve.

Revisions (0)

No revisions yet.