logoalt Hacker News

Rob Pike's Rules of Programming (1989)

697 pointsby vismit2000today at 9:59 AM366 commentsview on HN

Comments

elcapitantoday at 11:44 AM

Meta: Love the simplicity of the page, no bullshit.

Funny handwritten html artifact though:

    <title> <h1>Rob Pike's 5 Rules of Programming</h1> </title>
show 1 reply
yandrypozotoday at 2:51 PM

does _a speed hack_ mean adding time.Sleep() for testing? or it's something else?

treetalkertoday at 1:25 PM

I'm not a skilled programmer (but would like to be someday). Would someone kindly resolve what appears to me to be a contradiction between the following?

1(a) Torvalds: "Bad programmers worry about the code. Good programmers worry about data structures and their relationships."

1(b) Pike Rule 5: "Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming."

— versus —

2. Perlis 2: "Functions delay binding; data structures induce binding. Moral: Structure data late in the programming process."

---

Ignorant as I am, I read these to advise that I ought to put data structures centrally, first, foremost — but not until the end of the programming process.

show 3 replies
netbioserrortoday at 2:58 PM

This resonates as true, as long as the fundamentals of your tools are there. Picking interpreted languages or browsers as targets shoots you in the foot and sets you magnitudes behind when performance starts to matter. But if you're using a native-compiled language with value- and move-semantics, immutable data, and a composable type system, it's shocking how easy it can be to write obvious, maintainable, fast programs that perform under pressure, even when you're not being clever.

Thankfully newer languages like Nim, Odin, and Swift lean hard into value semantics. They drastically reduce the cost of focusing on data structures and writing obvious algorithms. Then, when bottlenecks appear, you can choose to opt into fine-tuning.

HardCodedBiastoday at 2:36 PM

Heretical opinion:

I think that Rob Pike was far more of a wordcel than a shape rotator for a famous computer scientist (which historically were very much on the shape rotator side).

ajpaulsontoday at 1:44 PM

I think I’m going to copy and paste this directly into my AGENTS.md file!

Mercuriusdreamtoday at 11:14 AM

never expected it to be a single HTML file so kind of surprised, but straight to the point, to be honest.

show 1 reply
fogzentoday at 3:01 PM

Rule 5 should be rule 1.

doe88today at 11:47 AM

Great rules, but Rule 3.: WOW, so true, so well enunciated, masterful.

show 1 reply
OpenDQVtoday at 2:48 PM

Golden rules for sure!

shashank-100today at 4:13 PM

rules are there until you break them

ekjhgkejhgktoday at 2:29 PM

Uuuh doesn't look good that you claim something is important enough to be in your top 5, but then misattribute it.

_philipalantoday at 1:36 PM

CS Unc remains un-chopped.

bsenftnertoday at 10:56 AM

Obvious. Why the elevation of the obvious?

show 7 replies
anthktoday at 11:21 AM

9front it's distilled Unix. I corrected Russ Cox' 'xword' to work in 9front and I am just a newbie. No LLM's, that's Idiocratic, like the movie; just '9intro.us.pdf' and man pages.

LLM's work will never be reproducible by design.

Shawn19s83today at 12:39 PM

surprised this isn't talked about more

jcmartinezdevtoday at 12:28 PM

Rule 6: Never disagree with AI slop

publicdebatestoday at 2:37 PM

"Rule 6: Don't waste time on syntax highlighting unless you're incompetent."

seedpitoday at 5:38 PM

[flagged]

openclaw01today at 11:45 AM

[dead]

SomaticPiratetoday at 3:06 PM

How quaint. I hope Claude/Codex reads this since from what I've heard here I'm not likely to need this rules anymore /s I am curious if anyone has attempted to use codex/claude with something like this in the prompt

catchcatchcatchtoday at 11:04 AM

[dead]

Iamkkdasari74today at 12:01 PM

[flagged]

wsesamemr81today at 3:19 PM

this matches my experience exactly

andxortoday at 2:33 PM

Great gonna add these to my CLAUDE.md /s

andrewmcwatterstoday at 4:34 PM

[dead]

seedpitoday at 11:38 AM

[flagged]