This is a list of programs/collections of code worth reading. Some are GreatProgramsToRead and some are not. What they should have in common is some educational merit. One should benefit from having read the programs listed here.
- JavaUnit. It's small, well written, crammed with ideas and popular to the point of ubiquity.
- JaxorFramework. It's a small, pattern-driven (lots of the patterns are from Fowler's Enterprise Patterns book) O/R mapper with reasonably high-level of test coverage.
- AxionDatabase. It's a database written in Java with good unit tests and ShortMethods. It's worth reading because databases are such a fundamental tool everyone should learn how they work.
- The standard Java APIs. The code for whatever JDK you're using is available in a file called src.jar. Open it with a zip tool and read. Some bits are very good and some bits are terrible but it won't hurt to understand the code that your code depends upon.
- The source for INN (InterNetNews - "a complete Usenet system"): http://www.isc.org/products/INN/
- Resin web server: http://www.caucho.com
- The Linux kernel sources and the educational merit in this is...?? Everyone should read at least one OS. It's a fast-track to understanding the whole pile from the hardware up to the apps, you learn the most vital design decisions underlying a platform, and you'll be able to reason about how they affect your own code. The coding techniques are different and noteworthy too. (not the original proponent)
- TexTheProgram: a large-ish, hairy, and exceptionally unbuggy program written using the technique of LiterateProgramming. Available in book form. Contains many interesting algorithms. Unfortunately it's written in Pascal. MetafontTheProgram? is similarly interesting, and to at least one reader's mind it has a larger density of neat algorithms.
-
- Anent the "exceptionally unbuggy" assessment: for over 13 years, Knuth kept a log of all the errors he found (or received reports of) in TeX, with notes as to how he fixed them. (He may still be keeping the log for all I know, but it had over 13 years of entries in it when it was published in 1991.) I can only say that I wish I had as short a bug list in some of my major systems after even just 5 years. Naturally, Knuth attributes his low rate of errors to his use of LiterateProgramming techniques. He published a paper, "The Errors of TeX", on this subject in 1989.
- ApacheLucene?. A brilliant example of API usability. High-level and low-level access, every piece sub-class-friendly and replaceable.
- Anything written by your friends! Reading and appreciating someone's program is a very nice thing to do.
- Would MozillaFirefox be something valuable to read and study?There would be merit in studying the MozillaBrowser suite in order to get a feel for LargeScaleCppSoftwareDesign. On the other hand the KDE libraries would be a better example assuming one was prepared to overlook the QT macro-based language extensions. [Actually, Mozilla exhibits a bit of AlternateHardAndSoftLayers: while various low-level components are C++, much of the UI and other code is written in MozillaXul and JavaScript. It's not really a joy to read though, and has a reputation for being a bit hairy.]
- BoostLibraries, the CeePlusPlus template libraries, for some really advanced template stuff. Advanced reading, but TemplateMetaprogramming is just a thing of beauty!
(It would be helpful if people adding items to this list would include some commentary explaining what makes the programs worth reading, and to whom.)
And why the choice of Pascal is unfortunate, or is that bit just flame bait?
-
- You're free to disagree, but there's more than just flame bait to this comment. See BrianKernighan's article WhyPascalIsNotMyFavoriteProgrammingLanguage for some cogent objections to Pascal -- at least, the dialect of Pascal that was available when Knuth was writing TeX. Many of Kernighan's objections, which were derived from his experience porting his book Software Tools from Ratfor to Pascal, are (not coincidentally) also things for which Knuth felt it necessary to provide workarounds in Web, the LiterateProgramming system he invented specifically for the implementation of TeX and Metafont. Knuth and Levy's later tool, CWeb, which is based on C an C++ rather than Pascal, omits certain features of the Pascal-based Web precisely because C, a more expressive and powerful language, doesn't need them.
See also LiterateProgramming