Abstractions and Regrets

Every Abstraction I Regret

The best code I ever deleted was a utility function called format_response. It accepted a response object, a format string, a fallback value, an optional transformer function, and a boolean for whether to strip whitespace. It was used in exactly one place. I wrote it because I thought I’d need it again. I didn’t. It sat in utils.py for eight months, collecting type: ignore comments and confusing every developer who opened the file. ...

February 20, 2026 · 7 min · Muhammad Hassan Raza
Component extraction cover

When to Extract a Component (and When to Just Copy-Paste)

Early in building Polaris, I extracted a ConfirmDialog component after using it exactly once. I figured I’d need it everywhere — deletes, password changes, dangerous actions. Classic foresight. Then the second use case needed a text input inside the dialog. The third needed two buttons with custom labels instead of “Confirm/Cancel”. The fourth needed async validation before confirming. Within a month, my clean ConfirmDialog had 8 props, 3 slots, and a mode prop that changed its behavior entirely. ...

February 12, 2025 · 3 min · Muhammad Hassan Raza