I'm sure we're all in favour of "clean code", but it's one of those motherhood-and-apple-pie things that no one can reasonably disagree with. Who wants to write dirty code, unless maybe it's for a porn site?

The problem, of course, is that few of us can agree on what "clean code" means, and how to get there. A rule like "methods should only do one thing", looks great on a T-shirt, but it's not so easy to apply in practice. What counts as "one thing"?

Over a lifetime of programming that began with a ZX81 and hasn't quite ended yet, I've found a few principles enduringly useful. Principles are more flexible than rules, and might be more widely applicable. So here are my five rules for CRISP code in Go: they're not necessarily in order of importance, except for the first one, but it makes a nice backronym.

continue reading on bitfieldconsulting.com

⚠️ This post links to an external website. ⚠️