{"id":13516038,"url":"https://github.com/darius/code-canon","last_synced_at":"2026-01-31T05:07:26.365Z","repository":{"id":32731738,"uuid":"36321906","full_name":"darius/code-canon","owner":"darius","description":"A catalog of code worth reading","archived":false,"fork":false,"pushed_at":"2017-05-25T17:22:16.000Z","size":6,"stargazers_count":111,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-01T20:36:08.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-26T20:28:56.000Z","updated_at":"2024-07-20T18:30:56.000Z","dependencies_parsed_at":"2022-09-12T19:51:13.640Z","dependency_job_id":null,"html_url":"https://github.com/darius/code-canon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darius%2Fcode-canon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darius%2Fcode-canon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darius%2Fcode-canon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darius%2Fcode-canon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darius","download_url":"https://codeload.github.com/darius/code-canon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246423527,"owners_count":20774795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T05:01:18.482Z","updated_at":"2026-01-31T05:07:26.340Z","avatar_url":"https://github.com/darius.png","language":null,"readme":"# code-canon\n\nYou've probably seen calls for recommendations for good code to read\nand study. When this comes up on aggregators and stackoveflow, the\nresult is pretty scattershot. Here is my own list, with only code I've\nread enough of to judge as in some way interesting.\n\nCanonizing my personal recommendations is a little fraught, since I\nknow some of the authors and potential authors. Don't take an omission\nas much of a signal; we all have finite time, biases, and different\ngoals and tastes. I'd love to get suggestions, by pull request or\notherwise.\n\nHopefully I'll add critical remarks, though I'm lazy.\n\n## Counterpoint: other lists, commentary, and tips\n\n(An exception to the my-own-judgement rule.)\n\n* http://www.gigamonkeys.com/code-reading/\n* http://www.hanselman.com/blog/CategoryView.aspx?category=Source+Code\n* Code Reading: The Open Source Perspective http://www.spinellis.gr/codereading/\n* Ask HN: What source code is worth studying? https://news.ycombinator.com/item?id=7602237\n* Ask HN: Good python code for code reading https://news.ycombinator.com/item?id=327710\n* https://python-guide.readthedocs.org/en/latest/writing/reading/\n* http://c2.com/cgi/wiki?ProgramsToRead\n* http://programmers.stackexchange.com/questions/38874/where-do-you-go-to-read-good-examples-of-source-code\n* http://c2.com/cgi/wiki?TipsForReadingCode\n* http://www.quora.com/Where-can-a-programming-beginner-go-to-read-good-code\n* http://www.readingcodegood.com/\n* http://www.sitepoint.com/reading-ruby-professional-development/\n* http://lukego.github.io/blog/2012/10/24/readable-programs/\n\n## Peter Norvig\n\n(I've contributed in small ways to several of these.)\n\n* http://norvig.com/paip.html\n* Java, Lisp and Python Essays at http://norvig.com/\n* IPython notebooks http://norvig.com/ipython/\n* \"Design of computer programs\" on Udacity https://www.udacity.com/course/design-of-computer-programs--cs212\n* on CodingBat http://codingbat.com/home/peter@norvig.com\n\n## Kragen Sitaker\n\n* [kragen-hacks](https://www.mail-archive.com/kragen-hacks@canonical.org/index.html) has lots of interesting short programs.\n\n## Barbara Liskov and John Guttag, Abstraction and Specification in Program Development\n\nIt's hard to find good models of contracts and invariants driving and\ndocumenting code. This book with its examples taught me this.\n\n## Kernighan and Pike, The Unix Programming Environment.\n\nSo old-school it’s practically prehistoric, but the best book I know\non the philosophy of Unix (with the possible exception of ESR’s The\nArt of Unix Programming, but that book has hardly any code, and thus\nis not so relevant to this question). The longest example is a small\nprogramming language with a compiler and VM interpreter developed in\nstages. http://cm.bell-labs.com/cm/cs/upe/\n\n## Kernighan and Plauger, Software Tools in Pascal.\n\nDevelops variants of a bunch of classic Unix tools, back before Unix\nbecame\npopular. http://www.amazon.com/Software-Tools-Pascal-Brian-Kernighan/dp/0201103427\n\n## Aho, Weinberger, Kernighan, The AWK Programming Language.\n\nMany surprisingly interesting and compact examples. (E.g. a ‘make’ in\nhalf a page of code, an assembler and interpreter, a command-line\ndatabase system, etc., etc., etc.) Code is available for download, but\nit’s best with the book, which is unfortunately ridiculously expensive\nthese days. http://cm.bell-labs.com/cm/cs/awkbook/\n\n## Chris Okasaki, Purely Functional Data Structures.\n\nJust what it says, with code in Haskell and ML. Not your parent’s\ndata-structures book. http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf\n\n## Donald Knuth, Literate Programming.\n\nHas a few extended examples doing neat\nthings. http://www-cs-faculty.stanford.edu/~knuth/lp.html\n\n## Mark Jason Dominus, Higher-Order Perl.\n\nIdeas from the functional-programming world brought to Perl. The\nlongest example is a constraint-based domain-specific language for\ndiagram drawing. http://hop.perl.plover.com/\n\n## James F. Gimpel, Algorithms in Snobol4.\n\nAn overlooked classic with lots of fun code in a terribly obsolete\nprogramming language. Emphasis on string processing. Hard to find. The\ncode is available online but probably hard to get much benefit from\nwithout the book. http://www.amazon.com/dp/0471302139/\n\n## Paul Graham, On Lisp.\n\nFine examples of the power of Lisp. The best chapters on macros I’ve\nseen anywhere. His programming style is not so much to my taste\n(favoring too-abbreviated global names, anaphoric macros, etc.) but\nstill interesting and educational.\n\nhttp://www.paulgraham.com/onlisp.html\n\n## Peter Seibel, Practical Common Lisp\n\nhttp://en.wikipedia.org/wiki/Practical_Common_Lisp\n\n## Richard O'Keefe, The Craft of Prolog.\n\nA bit of a grab-bag but a tasteful exposition of ideas and examples\nrelevant to functional programming as well as Prolog. O'Keefe is\nentertainingly opinionated, not unlike Snape at Hogwarts when a\nstudent screws up. http://www.amazon.com/dp/0262150395/\n\n## Leon Sterling (editor), The Practice of Prolog.\n\nA collection of articles, each an extended example, with code, of\nmaking Prolog do something interesting, usually something\nAI-ish. Chapters by O'Keefe, Chris Mellish, Sterling,\nothers. http://www.amazon.com/dp/0262193019/\n\n## P.J. Plauger, The Standard C Library.\n\nA full, portable, clean, reasonably efficient implementation of the\n(C89) standard library, with discussion of the design tradeoffs. Includes\nthe relevant pages from the standard.\nhttp://www.amazon.com/dp/0131315099/\n\n## Edsger Dijkstra, A Discipline of Programming.\n\nLots of small but nontrivial examples of developing a program and its\nproof of correctness\nhand-in-hand. http://www.amazon.com/dp/013215871X/\n\n## https://github.com/rswier\n\nI've read https://github.com/rswier/c4 but not\nhttps://github.com/rswier/swieros\n\n# Others' suggestions, or otherwise pending\n\n* [Physically Based Rendering: From Theory to Implementation](http://www.pbrt.org/)\n* [Lisp in Small Pieces](http://pagesperso-systeme.lip6.fr/Christian.Queinnec/WWW/LiSP.html)\n* [Implementing Elliptic Curve Cryptography](http://www.manning.com/rosing/)\n* \u0026lt;your favorites here\u0026gt;\n","funding_links":[],"categories":["Technical"],"sub_categories":["ramanihiteshc@gmail.com"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarius%2Fcode-canon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarius%2Fcode-canon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarius%2Fcode-canon/lists"}