Code to read

The best way to learn programming is by writing programs. Reading programs written by brilliant programmers is equally important. If someone asks me for source code to read and learn from, without a second thought I will point him to SQLite. The following merits make the SQLite source code an ideal learning ground for programmers:

  • Informative, balanced comments.
  • Good coding practices: well factored-out functions, idiomatic use of the implementation language, consistent style, comprehensive tests etc.
  • A real world project. Probably SQLite is the world’s most widely deployed database! Still it is small and amicable to a single brain.

SQLite is implemented in C. Are there open source projects written in other languages/paradigms that have all the above qualities? Personally, I would like to know about a Lisp project. Many will be interested in Java/C++ projects because millions of words have been written (wasted??) about designing ‘maintainable object-oriented software’. It will be informative to to see this ‘wisdom’ in practice.

I raised the same topic at stackoverflow and got a few answers. Unfortunately, some people found it to be “subjective and argumentative” and voted to close it :(.

Update 29/12: This has been voted as a “Great Question” on stackoverflow. The reason for closing the question has changed to: “Questions on Stack Overflow are expected to generally relate to programming or software development in some way…” lol :–/). A question could be up-voted as “Great” and it could be closed as irrelevant at the same time! Is there something wrong with the stackoverflow voting system?