Back in 1989, when RAM was measured in Kilobytes, monitors were strictly black-and-green, and StackOverflow wasn't even a fever dream, the absolute legend Rob Pike (co-creator of Go and Unix) dropped 5 programming commandments. The crazy part? Over 30 years later, these rules are still slapping modern over-engineering devs right in the face.
The 5 Golden (and slightly rusty) Rules of Rob Pike
For those of you too lazy to read the ancient scrolls, let me break down Pike's rules. They sound incredibly obvious, but when we're deep in the IDE, 90% of us forget them completely.
- Stop guessing your bottlenecks: You literally cannot tell where a program is going to spend its time. Bottlenecks hide in the most ridiculous places. So, don't try to be a smartass and put in a speed hack until you've actively proven that's where the lag is.
- Measure first, flex later: Following up on Rule 1: Measure. Don't tune for speed until you've measured it. And honestly, even then, don't bother unless that one specific part is choking the whole system.
- Fancy algorithms are usually useless: Complex algorithms look cool on paper, but they crawl when $n$ is small. And guess what? $n$ is almost always small in the real world. Keep it simple.
- Complexity breeds bugs: Fancy algorithms are buggier and a pain in the ass to implement. Pike's advice? Use simple algorithms and simple data structures. Period.
- Data is King (The Final Boss): Data structures, not algorithms, are the core of programming. If you've chosen the right data structures and organized things cleanly, the algorithms will practically write themselves.
What the dev community is yapping about
Since the original post is a collection of silent head-nods from veteran devs, here's the general consensus from the trenches when these rules get brought up:
- The Anti-Spaghetti Squad: Lately, everyone is relying on AI to spit out complex, design-pattern-heavy spaghetti code just to look smart. Reading Pike's rules is a massive reality check. If you're building a simple CRUD app, you don't need a microservices architecture, bro.
- The Data Structure Cult: Devs aggressively agree with Rule 5. Remember Linus Torvalds' famous quote? "Bad programmers worry about the code. Good programmers worry about data structures and their relationships." Great minds think alike.
- The "Throw Money At It" Bros: Some chaotic evil devs argue these rules are outdated. "Just grab some Free $300 to test VPS on Vultr, cloud scaling is cheap!" they say. Sure, chucking raw CPU power at bad code sounds like a plan, right until that AWS bill bankrupts your startup at the end of the month.
The C4F Verdict: How to not get fired
Long story short, Pike's rules boil down to one undeniable principle: KISS (Keep It Simple, Stupid).
As a dev, the ultimate flex isn't writing code so cryptic only God and you understand it. The real flex is writing code that you can read 6 months later without wanting to punch yourself in the face. Spend less time grinding LeetCode Hard algorithms and more time designing proper data structures. And please, for the love of sanity, stop premature optimization. Make it work first, make it fast later!
Source: Rob Pike’s Rules of Programming (1989) on Hacker News