News for hackers. Stuff that matters.

Ask HN: Examples of good code?

I'm looking for examples of well-written code (open-source projects), for study material.

If you have come across code, from which you learnt a lot by reading it, please share.

Thanks!

( 4 comments | 4 points | on HN )
Re:Ask HN: Examples of good code? by geocar on Sunday November 15, 2015 @02:27PM (#10570730)
Most recently for me, I saw Arthur's code which might not be what you're looking for. The origins of J[1], is publicly available C code, and even if it doesn't move you, consider spending some time on it anyway.

When I was younger, I learned a lot from reading djb's code[2] changed the way I think about application design and [3] changed my mind about system administration. Actually everything djb wrote is worth learning from.

Before that I recall specifically sicp[4] giving me a lot to think about.

There are also bigger things (like plan9[5] and emacs[6]) that I've found interesting.

[1]: http://nsl.com/papers/origins.htm

[2]: http://cr.yp.to/djbdns.html

[3]: http://cr.yp.to/daemontools.html

[4]: https://mitpress.mit.edu/sicp/

[5]: http://9p.io/plan9/index.html

[6]: http://www.gnu.org/software/emacs/

Re:Ask HN: Examples of good code? by dozzie on Sunday November 15, 2015 @06:10PM (#10571667)
I wouldn't invoke DJB's daemon as an example of good code. It's awful, its structure is terrible, file structure is terrible as well.
Re:Ask HN: Examples of good code? by sebleblanc on Sunday November 15, 2015 @02:24PM (#10570712)
SQLAlchemy[1] is a large project with a very solid codebase; it is very well documented and the API is exemplary.

1: https://github.com/zzzeek/sqlalchemy/

Re:Ask HN: Examples of good code? by daly on Sunday November 15, 2015 @07:52PM (#10571996)
Physically Based Rendering by Pharr and Humphreys (a literate program) is exceptionally readable ndncdall of the source code. It won an Academy Award.