8 ms·
Code which every programmer must read before dying
What open source codes/projects must every programmer read before his death?
- dsm 15y agoI'd say the original lisp paper: http://www-formal.stanford.edu/jmc/recursive/recursive.html http://www-formal.stanford.edu/jmc/recursive/recursive.html by John McCarthy
- michaelcampbell 15y agoDuff's device.
- thirsteh 15y agoI think a very good example of when OOP is genuinely useful and desirable is the Twisted Networking Engine: http://twistedmatrix.com/trac/browser/trunk/twisted http://twistedmatrix.com/trac/browser/trunk/twisted
- willvarfar 15y agoCrikey, that's like recommending the Bourne Shell (which was a bunch of macros so you could write ALGOL-like code in C)! http://en.wikipedia.org/wiki/Bourne_shell#Quotes http://en.wikipedia.org/wiki/Bourne_shell#Quotes twisted is, well, twisted. And that's what it does to your head too.
- thirsteh 15y agoJust to clarify, I'm not talking about event-driven programming, errbacks and callbacks, but rather how they've done all of the abstraction of the different protocols and subsystems. It's one of the few times where I've considered inheritance absolutely essential.
- willvarfar 15y agoStill sceptical. Pretty much every other reactor system is cleaner and easier. I fight twisted every day and rue the day I picked it for a big project.
- dipshit 15y agoThis is very unpythonic example of coding. bullshit
- madhouse 15y agoThere is no single code or project that I could name. Not because there are no open source codes or projects that weren't worth reading, because there are thousands of them. I couldn't name any, because people are different, and what one finds good and worthy code, the other finds rubbish - thus, there can be no single project that would make every reader happy. On the other hand, if you look at the question in a different way, you could say that the code (be it open source or not) every programmer must read before his end, is his own. As one looks at his life in one's deathbed, so should a programmer look at his code.
- jarek-foksa 15y agoIf you are fronted web developer then you should defenitely read jQuery sources. There is a lot of patterns that you could borrow and reuse in your own JS libraries. A good place to start is this interactive code viewer: http://www.keyframesandcode.com/resources/javascript/deconstructed/jquery/ http://www.keyframesandcode.com/resources/javascript/deconst... There is also a great presentation by Paul Irish ("10 Things I Learned from the jQuery Source"): http://www.youtube.com/watch?v=i_qE1iAmjFg http://www.youtube.com/watch?v=i_qE1iAmjFg
- thirsteh 15y agoSQLite probably has some of the cleanest and most elegant C you will ever see: http://www.sqlite.org/sqlite-src-3070602.zip http://www.sqlite.org/sqlite-src-3070602.zip
- piotrSikora 15y agoI won't argue about code quality of SQLite, because I know it's superb, but the coding style is just horrible. Take a look at anything in OpenBSD (ex: http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/bgpd/bgpd.c?rev=1.166 http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/bgpd/bgpd...) or nginx (http://nginx.org/download/nginx-1.0.0.tar.gz http://nginx.org/download/nginx-1.0.0.tar.gz).
- thirsteh 15y agoYou're right, Nginx is great too. (I'm not familiar with the OpenBSD source, but it looks good.) I probably prefer Nginx to SQLite, but I think that's mostly personal preference -- I don't like excessive in-source documentation.
- michaelcampbell 15y ago> but the coding style is just horrible. I had to go look. I agree; there are some things done consistently in the code that are high on my nitpick "don't do that" list. Ugh. I'd have to reformat to work on it, then format to whatever standard they use on checkin, I think.
- Kafka 15y agoThe Sudoku solver by Peter Norvig http://norvig.com/sudoku.html http://norvig.com/sudoku.html and not only for the code but also for the excellent essay.
- willvarfar 15y agoLiterate programming is the style of programming that's intended to be read: http://www.literateprogramming.com/ http://www.literateprogramming.com/ Quite the contrast with the Bourne Shell: "Nobody really knows what the Bourne shell's grammar is. Even examination of the source code is little help." – Tom Duff http://en.wikipedia.org/wiki/Bourne_shell#Quotes http://en.wikipedia.org/wiki/Bourne_shell#Quotes
- deleted 15y ago[deleted]
- camperman 15y agoSpeaking of Tom Duff, his Device is well worth studying. [edit] michaelcampbell has already recommended it below - missed that.
- gavaletz 15y agoThe Linux kernel. If you look at it really closely it isn't so pretty, but its massive size and overall complexity for me (as an undergraduate) was like looking into the grand canyon. What's more impressive is the speed at which things change and that despite breaking all of the traditional rules for "good" software design practices...it works amazingly well.
- ignifero 15y agoI haven't seen the whole of it, but it's not ugly and doesn't break all the rules of good design.
- larsen 15y agoOne of my university professors some years ago said the source of Rogue was one of the C program he read. I've never been able to find it, and I am curious since then. Does anyone?
- mjmoch 15y agohttp://www.roguelikedevelopment.org/archive/index.php http://www.roguelikedevelopment.org/archive/index.php
- wsxiaoys 15y agoFinch is really a clean compiler implementation in C++, it's kind of weird to me when reading its code express nasty things in a clear way in C++ http://finch.stuffwithstuff.com/ http://finch.stuffwithstuff.com/
- deleted 15y ago[deleted]
- bxr 15y agoWhen I downloaded mongrel2 I wanted to take a quick peak at superpoll beyond what was in the blog post about it, an hour later I was still reading the source. It is some of the best-written C I've seen.
- tsigo 15y agoBased on a blog post that made the rounds a while ago -- http://tomayko.com/writings/unicorn-is-unix http://tomayko.com/writings/unicorn-is-unix -- Unicorn might be a good read for Ruby-related stuff. https://github.com/defunkt/unicorn https://github.com/defunkt/unicorn
- jacques_chester 15y agoI was fairly impressed with the PostgreSQL sources when I was poking through them once.
- avstraliitski 15y agoHello world in machine code for any platform.
- lylejohnson 15y agoIt's been awhile since I studied it, but I recall the Python (C) source code being very readable.
- seige 15y agoMost of the code written by _whyfan is pretty awesome in my book.
- zguy 15y agoProbably the most funny source code I encountered was that of the linux kernel, just look for comments. If you just want to die by reading code, you can try to understand how Xen works ;) (disclaimer, it is actually very elegant)
- vithlani 15y agoHow about the Lion's book? http://en.wikipedia.org/wiki/Lions_Commentary_on_UNIX_6th_Edition,_with_Source_Code http://en.wikipedia.org/wiki/Lions_Commentary_on_UNIX_6th_Ed... Get the source code from http://minnie.tuhs.org/cgi-bin/utree.pl http://minnie.tuhs.org/cgi-bin/utree.pl
- sunkencity 15y agoWordPress - because it's extremely crappy but at the same time insanely accessible. Lots of lessons to learn. Passenger - code looks good even though it's C++ Rails 3. Beautifully structured application foundation that's not just a pretty piece of code, it's tested and works. JScheme. Reading this clean implementation and re-implementing it yourself gives a good basis of understanding for lisp.
- r0h4n 15y agoSo many great projects listed here, please keep posting more guys. I will compile a list of all later.
- homofaber 15y agoIf you have only few minutes before execution, and want to fix an old X programming mystery, I would suggest dwm.c: http://hg.suckless.org/dwm/file/e901e70f69e8/dwm.c http://hg.suckless.org/dwm/file/e901e70f69e8/dwm.c It is so easy to understand inner workings of window manager in X reading this code, and you do not need much time for it (>2000 SLOC).
- IvarTJ 15y agoAs a relatively new C programmer, I have followed the dwm source code while trying to make my own window manager. It has been very helpful.
- noselasd 15y agoPlan 9 source code (http://plan9.bell-labs.com/plan9/ http://plan9.bell-labs.com/plan9/), mostly for its historical value - created by the same team that made C and Unix - and for an insight on how those people envisioned the evolution of Unix.
- kunjaan 15y agoThese two are the works of very very smart programmers: 1. The Racket source code 2. The Chromium source