Fog Creek Software
Discussion Board




Code reading


I would like to read efficient, robust, clean code.

Can anyone recommend me some widely available source code to look at ?

Maybe a compiler or an OS ?

Something which is full of wonderfull tricks and where I can learn some stuffs from

Codex
Sunday, April 27, 2003


Recommending...

http://msdn.microsoft.com/net/sscli/

Or...

http://www-124.ibm.com/developerworks/oss/jikesrvm/download/index.shtml


Or for something smaller,
 
http://www.sweetcode.org/

PSTZZZQ

Snyder
Sunday, April 27, 2003

The Linux kernel source code should qualify :)

Patrik
Monday, April 28, 2003

Knuth, "TeX: The Program" and "METAFONT: The
Program". They are certainly efficient and robust
code. They're better documented than almost any
other code you're ever likely to read. And they're
close to bug-free.

On the other hand, they're written in Pascal, in a
rather old-fashioned style. And they're designed
for old slow machines with not much memory. That's
one reason *why* they're unusually efficient code,
but some of the tradeoffs Knuth makes wouldn't
seem so reasonable these days.

If you're only going to look at one of those, make it
METAFONT, because (1) there are more cool
algorithms there and (2) what METAFONT is doing
is probably more interesting to most people than
what TeX is doing. (For the most part.)

The gzip source code is unusually well commented,
and does some interesting things.

You could look at bigger things like Linux, FreeBSD,
gcc, and so on. Be warned that you'll need to put in
quite a lot of work to understand what's going on
with a large system.

Gareth McCaughan
Monday, April 28, 2003

the linux kernel source code is not clean and easy to read. look at openbsd's pf code...it's clean.

Drano
Monday, April 28, 2003

Drano,

>the linux kernel source code is not clean and easy to read.

Compared to alot of old commercial C code I've seen it is,
but whatever...

Patrik
Tuesday, April 29, 2003

*  Recent Topics

*  Fog Creek Home