Skip to content
Mermaid templates

Decision Tree — Should I Refactor?

A quick heuristic for deciding whether to refactor code now.

Template previewMermaid
Rendering…

Make it your own.

flowchart TD
    A([Touching this code?]) --> B{Will you change it<br/>again soon?}
    B -->|No| Z[Leave it]
    B -->|Yes| C{Is it hard<br/>to understand?}
    C -->|No| D{Tests exist?}
    C -->|Yes| E[Refactor for clarity first]
    D -->|No| F[Add tests, then change]
    D -->|Yes| G[Make the change]
    E --> D
    F --> G
    G --> H([Ship + observe])