Live data from Hacker News

Ask HN: What source code is worth studying?

news.ycombinator.com

51–60 of 117 posts

Re: Ask HN: What source code is worth studying?

#51
One way I've found to start reading code (something that I do not find easy at all) is to read code you use. Lately, I've been reading pyparsing and the Python markdown module. As an added bonus, I also discovered features in those libraries that I never knew existed.

Re: Ask HN: What source code is worth studying?

#54
I'm going to get downvoted for picking a non-open source option but...

The NT kernel is the most beautiful piece of code I've seen. Dave Cutler and team wrote some very, very elegant code that anyone (even if you're not a kernel hacker) can understand. If I need 'code inspiration', I spend some time looking through their code.

Now, the NT kernel itself doesn't have source out there but for folks who are students, you should be able to get your hands on the Windows Researh Kernel (http://www.microsoft.com/resources/sharedsource/windowsacade...). This has all the good stuff (and is much easier to build too)

Re: Ask HN: What source code is worth studying?

#56
One way to find code worth reading is to select inspiring developers and look at their code. Most of the developers in "Coders At Work" for example, have Open Source code we can look at learn from.

The best code I've seen: -

Common Lisp - "Paradigms of Artificial Intelligence Programming" by Peter Norvig and "On Lisp" by Paul Graham

C - "C Interfaces and Implementations" and "LCC- a compiler for ANSI C" both by David Hanson. I also found the code for the Player/Stage robotic sim framework surprisingly readable.

I liked the Scala Actors library code as well.

If any HNers know any great codebases in Haskell or Erlang, please post here.

Re: Ask HN: What source code is worth studying?

#57

"Code reading requires its own set of skills, and the ability to determine which technique to use when is crucial. In this indispensable book, Diomidis Spinellis uses more than 600 real-world examples to show you how to identify good (and bad) code: how to read it, what to look for, and how to use this knowledge to improve your own code." http://www.spinellis.gr/codereading/

This is a good read and uses lots of examples from one of the BSDs (NetBSD as I rememeber).

Re: Ask HN: What source code is worth studying?

#59
post #37

Any recommendations for Ruby/Rails projects?

Ryan Tomayko recommends Unicorn as a reference for Unix programming (primarily, signals and sockets):

http://tomayko.com/writings/unicorn-is-unix

I found Sinatra to be an interesting read (and specifically how it parses the app configuration into methods):

http://github.com/sinatra/sinatra

Re: Ask HN: What source code is worth studying?

#60
post #7

The Linux kernel: http://miller.cs.wm.edu/

Equally or more valuable than trying and sit down to read the kernel source is to follow the patches and discussions thereof on the linux-kernel mailing list: http://lkml.org/

I've found that doing so a) improves my knowledge of what's going on under the hood tremendously, and b) has taught me a fair bit about how to do code reviews and make difficult design decisions. Studying the kernel itself line-by-line would take ages, but reading a few threads a week depending on what piques my interest is totally manageable.

Post reply on HN