Skip to main content

What is a Hack?

A "hack" in a codebase doesn't have any relation with actual "hacking" it is an often improvised solution that solves a problem but isn't a proper solution. It's a kind of shortcut or a makeshift fix intended to make something work temporarily or to get around a particular issue.

In essence, it's like using duct tape for a DIY project: it can hold things together, but it might not be the most reliable or stable solution.

Why is it in the documentation?​

Hacks by their nature are often hard to understand if you don't already know what they are. And sometime understanding why a hack has been made instead of a proper solution is necessary to make that proper solution. This is the reason documenting the why, how and when of hacks is crucial.

But if it works, it works, right?​

Yes, if it works, it works... except when it doesn't.

Hacks are a form of technical debt and like any kind of technical debt they should be avoided when possible and reduced over time.