

Ask YC: Code Digesting - nsrivast

In a 1986 Bill Gates interview linked to by an earlier YC post (http://news.ycombinator.com/item?id=194844) was the quote:<p>"I still think that one of the finest tests of programming ability is to hand the programmer about 30 pages of code and see how quickly he can read through and understand it."<p>Do you agree this was true in 1986? Is it still true now? If your two answers disagree, whence the difference?
======
swoodtke
In any non-trivial project there comes a time when code becomes...
complicated.

No matter how well designed the code and no matter how often the code is
refactored, reality imposes on that neatly designed little world and makes the
code sub-optimal.

This is when being able to understand code becomes important. To get inside
the head of the author is an invaluable skill (even if the reader and the
author are the same person separated in time). To understand why they did what
they did (the answer is not always "they were morons"). To understand how to
change the code and still guarantee the underlying assumptions.

Also, I would say that being able to read and understand code is even more
important when your co-workers are equal to or above your skill level. To try
to puzzle out why they did something can lead to an "aha!" type moment which
are invaluable in learning new ways of solving problems.

So I would say that being able to read code is important. Maybe not "one of
the finest tests" but an important test nonetheless.

------
luckystrike

      I still think that *one* of the finest tests ...
    

I agree it is one of the most important trait of a good programmer to
understand other people's code. One can only be good at programming by writing
code and reading other people's (good) code to keep on improving and acquiring
knowledge.

If a person is good (and quick) at understanding someone else's code, it is a
good indication of him/her being blessed with a good analytical mind, and
experience/habit of delving in to code.

Of course, this ability helps when working in a team, but more importantly it
is required to understand the existing solutions and their
drawbacks/advantages. e.g. If one intends to write a web server or a new VM
for a language, it would be helpful to refer and understand the existing open
solutions, before starting out.

In short, the ability to understand someone else's code quickly is a definite
pointer of a good _potential_ programming ability. Getting a person to write
code is the best test most times, but the ability to adapt and learn new
language/technology faster is governed highly by ability to read code.

------
mooneater
If you work at Microsoft (or somewhere else with teams and long-lived
products), you have to read a lot of other people's code, so its true.

If not, maybe not so much.

------
edw519
Makes no sense to me. Never did. The speed which the code can be understood
says much more about the writer than the reader. I have business analysts,
project managers, and users that can read and understand my code. Do you
really think that's a valid test of "programming ability"?

Also, consider:

1\. 30 pages of well written code != 30 pages of poorly written code

2\. 30 pages of well documented code != 30 pages of poorly documented code

3\. 30 pages of high level code != 30 pages of low level code

4\. 30 pages of COBOL != 30 pages of BASIC != 30 pages or Java != 30 pages of
Python

5, 30 pages of Microsoft code = 1 page of mortal code

The finest test of programming ability is what you can build that satisfies
requirements and works perfectly. I'm not sure Bill Gates ever understood
that.

~~~
nsrivast
Even if that is true, it can _still_ be true that a good way to judge between
two coders is to look at how fast they can understand a piece of test code
(they look at the same one, of course). If true, it could be a faster test
than having them both write an application, no?

~~~
edw519
Interesting point. You'd have a control, but a control that I place little
value on.

In your example, I'd still have them both code _something_. That's almost
always a half hour well spent.

