Hacker News new | ask | show | jobs
by jimbokun 2639 days ago
"The only criteria I have for good code these days is "Does it work", "Can I understand it"."

Which of course, are not trivial to achieve by any means.

Maybe also add "Can my coworkers understand it?" Which might be a very different metric.

"I would have read, in their place, books on type theory and OS design, Posix, in other words things that actually help me build stuff and get things done and that I subsequently had to read later."

If you want to get very far with any of those, you will need to write "good code", as you have defined it. So maybe a better way to understand good code would be to read the code of large projects implementing the things you want to learn about?

1 comments

I don't know. Procedural code in Golang is pretty trivial - you basic constructs are regular in the selection, iteration, and sequence sense with a sprinkle of interfaces and some CSP constructs for concurrent design. That covers like 99% of what you need to write good code. I'd say pattern matching is pretty helpful Ala ML, Haskell, Rust. Beyond that all the GOF and Solid and all that jazz seems to do way more harm than good IMHO.

> If you want to get very far with any of those, you will need to write "good code"

If you have ever looked at the code of the most successful programs the code is anything but "good". Have you glanced at the Linux Kernel code lately? But again, "good" is very subjective. The Linux Kernel works well enough to server the purpose of millions of users and enough people understand it. Its good code!