

Ask HN: Looking for examples of "really great code"? - andrewstuart

Is there any code that is "widely accepted" as being "really great code"?<p>I would like to use this in a research exercise.<p>The context is that many companies wish to "examine your code" as part of their recruitment process.<p>I believe that "examining code" is an extremely poor way of evaluating someone, and that the results of such assessments are extremely subjective and ultimately meaningless.<p>One of the most effective ways to prove this is to take some code that is widely regarded as being "really great code" and ask various people how they would rate the programmer based on that code.  My prediction is that many people will assess this code to be of poor quality.<p>In an ideal world I'd like to find "generally accepted" "really great code" in a variety of languages, but even one example would be a starting point.<p>Specifically it would be good to find some of Bill Joy's original TCP/IP implementation code.  This unfortunately will only be of limited value however as it's not going to be object oriented, and OO is something that all employers look for these days.<p>EDIT CLARIFICATION:
I'm looking for code that can be specifcally attributed to one individual programmer.<p>For example it would be good to identify code that is written purely by John Resig, or code that is written purely by James Gosling.  I need to be able to attribute all of that code purely to one individual programmer.
======
andrewcooke
<http://norvig.com/sudoku.html> (norvig)

<http://okmij.org/ftp/> (oleg)

<http://www.lua.org/source/5.1/> <http://www.lua.org/doc/jucs05.pdf> (unsure,
but it's either 1 person or small team)

[http://svn.python.org/projects/python/trunk/Objects/listobje...](http://svn.python.org/projects/python/trunk/Objects/listobject.c)
[http://svn.python.org/projects/python/trunk/Objects/listsort...](http://svn.python.org/projects/python/trunk/Objects/listsort.txt)
(tim peters)

[http://en.wikipedia.org/wiki/Lions%27_Commentary_on_UNIX_6th...](http://en.wikipedia.org/wiki/Lions%27_Commentary_on_UNIX_6th_Edition,_with_Source_Code)
(ok, so lions didn't write the code)

<http://www-cs-faculty.stanford.edu/~uno/plain.tex>
<http://www.tug.org/TUGboat/tb16-3/tb48bzyl.pdf> (knuth)

[when two links appear on a line the second describes the first]

~~~
andrewcooke
<http://doom.wikia.com/wiki/Doom_source_code> (john carmack et al - you may be
able to find which parts carmack wrote from articles or code comments;
apparently there's a commit log too)

------
nostrademons
I believe the point of examining code is usually to eliminate "really crappy
code", it's not to determine "really great code". The code sample is usually a
qualifying factor, not a determining one.

People may disagree on what constitutes great code, but most people reasonably
skilled in the art can agree on when code is crappy.

~~~
andrewstuart
I don't agree. My assertion is that person X might think a code sample is
crappy, but person Y will not think it is crappy code.

I am expecting this is especially the case where the person assessing the code
does not understand what the code does (i.e. a "lesser" programmer assessing
the work of a "greater" programmer)

~~~
wreckimnaked
'Good code' is more of common sense than personal preference. Maybe you should
have a look at one of the cited examples ;)

~~~
andrewstuart
Interesting thought. This is the heart of my argument. "Good code is common
sense" makes me wonder where is the science in deciding if code is good or
not.

When deciding if code is good or not, surely there should be quantified
criteria for assessment. Code cannot be judged to be "good" or "not good"
without specific pre defined measures of assessment. I would suggest that
close to 0% of employers that want to "see your code" are assessing against
pre defined assessment criteria.

~~~
wreckimnaked
Well, scientific metrics of code quality may be more related to software
design than the code craftsmanship itself.

A good experience would be get 4 experienced developers to read and evaluate a
piece of code; that'd raise some interesting practical aspects of their
evaluation of its goodness.

------
misiti3780
<https://github.com/facebook/tornado/>

<https://github.com/django/django>

<https://github.com/git/git/>

<https://github.com/torvalds/linux>

~~~
andrewstuart
All great examples but I'm trying to find code that can be definitively
attributed to one single person.

------
bishnu
The source code for the Tarsnap client
(<https://www.tarsnap.com/download.html>) is some of the best-written C I have
ever seen. As far as I can tell it was 100% authored by cperciva.

~~~
andrewstuart
What makes you think it is good code? Specifically.

~~~
btmorex
I was curious so I took a quick look. Good indicators are:

1\. Most of the code is error checking/handling. This isn't necessarily a good
indicator in general, but for C code it is.

2\. Consistent style.

3\. Functions are static unless otherwise needed.

2 and 3 seem minor, but in my experience, 2 is indicative of someone who pays
attention to details and 3 suggests that the person is an experienced C coder.

------
zengr
Mongrel[1] has mostly code written by Zed Shaw, I like his style! Very
consistent.

    
    
        [1]: https://github.com/mongrel/mongrel

------
rickr
I'm certainly no expert, and it's not OO but I've always enjoyed reading the
code of some of the coreutils.

~~~
umenline
Qt source code

------
codegeek
Have you checked Linux kernel by Linus Torvalds ?

~~~
andrewstuart
I'm looking for code that can be definitely attributed entirely to a single
developer. I'm pretty sure Linus is not the only developer of that code. Also
it's C, whereas most companies these days are looking for OO coding so C is
somewhat less relevant for my specific purpose in this exercise.

~~~
elclanrs
Why not just go to github and explore the most popular projects? As an
experienced programmer you can tell if it's good code or bad code. In
JavaScript is even more clear, since there are lots of DONT'S, you know,
`eval`, `==`, `with`, etc...

~~~
andrewstuart
I'm trying to find code that is widely accepted as being great code. The
popularity of a project is not as effective ass attribution to a specific well
known developer.

