Live data from Hacker News

Ask HN: What source code is worth studying?

news.ycombinator.com

81–90 of 117 posts

Re: Ask HN: What source code is worth studying?

#83
post #80
post #67

Earlier quoted context omitted.

This really depends on the language. Ruby's code is (or at least was) quite nice. It is pretty much OO written in plain C. By contrast Perl makes very heavy use of macros for portability, to an extent that may induce brain lock in many people, and makes your debugger very hard to follow. This is not to say that its use of macros is a bad thing in the end, but it is a definite shock.

Yeah, after hacking with perl for a while, i got interested in how it worked under the hood, and had some trouble following. Check out the regex compilation module: http://cpansearch.perl.org/src/GBARR/perl5.005_03/regcomp.c And execution: http://cpansearch.perl.org/src/GBARR/perl5.005_03/regexec.c

Well, anything touched by Ilya Zakharevich is going to be hard to read, even by the standards of the Perl source code. That means that the regular expression engine will be particularly hard to read.

Re: Ask HN: What source code is worth studying?

#85
post #38

Any recommendations for php? I wrote a php/mysql web application for SaaS customers. I am looking at ways to improve performance/cache/error handling or simply write a better code.

There's a lot of excellent PHP code in the Horde Project's repository: http://cvs.horde.org/

There is no such thing as excellent PHP code.

Re: Ask HN: What source code is worth studying?

#87
post #20
post #15

Earlier quoted context omitted.

I agree with this, and along the same thought, OpenBSD (or any BSDs really, but OpenBSD tends to favor simpler implementations) source is very clear and concise.

Minix, not being as 'real world' as the BSD's or Linux, is even more readable, if you're just interested in a quick glance at how an OS works.

Minix3 has comments galore, but seems plagued by one/two letter variable names like 'c' and 'ip'

Re: Ask HN: What source code is worth studying?

#88

Earlier quoted context omitted.

for an easier time, your favorite language interpreter's source code ... interpreters are easier to comprehend than compilers, since you can 'follow along' with the flow of execution in the main interpreter loop just like you're executing a program ... e.g., creating stack frames, allocating heap memory, assigning variables, etc.

Squeak Smalltalk. For Java, if you can get hold of it, the old Acme Webserver. That was very clean code.

Squeak is pretty sweet. I was looking at the Kernel category and the Parser classes. Pretty clean stuff.

Re: Ask HN: What source code is worth studying?

#90
post #39

Quake source code: www.idsoftware.com/business/techdownloads/ From a graphics and game engine perspective, it was very informative to go through pieces of of the source - I was mainly interested in the client/server and collision detection areas of the code.

I second this. It's cool that the ideas behind some of the more simple things in the Quake game (such as the console, bindings, commands, etc.), are still being used as the back bone of other products (see: Valve). They are implemented very elegantly in the Q1 source.
Post reply on HN