
Survey: How many lines of code can you clearly visualize? - palish
I asked a productive coworker if he always kept his code "in his head" while he worked.  He replied, "When I was younger, I could keep three thousand lines of assembly code in my head.  I could go to the exact line of any feature instantly."<p>He single-handedly wrote several games for major publishers (Electronic Arts and others) when games were becoming popular.<p>So, setting aside for a moment that number-of-lines-of-code is a bad measurement, how many lines can you clearly picture in your head?  Just throw out a rough estimate.
======
marcus
You don't hold line of codes in your head, you hold a map of interconnected
concepts, in various zoom levels.

Zoom enough and you'll see lines of codes, but most of the time you just
manipulate these larger blocks.

As you build up your language for your specific problem and your tools of
expressions evolve, each concept maps significantly more behavior, logic &
power.

A good example for this can be seen in professional chess players playing
blind-folded, they don't memorize the location of all 32 pieces on the board,
they memorize the different formation groups, their mental vocabulary has
increased to include groups of chess pieces in specific arrangements. If you
ask them to remember randomly placed chess pieces they fail just like the
average person.

------
mironathetin
As long as I work on one problem, I remember all methods I have written and
what they do. I also keep the architecture in my head and the approach I have
chosen to solve the problem. This works fine as long as I am not interrupted.

I cannot recommend trying to hold too much in your head at once. I has a bad
effect on your creativity. Free your mind instead to have all necessary
resources available to find the best solution for the current problem.

It is also an achievement to break down large chunks of work into small parts
and solve only the small parts.

In this perspective it is absolutely useless to keep code in the head. It is
written in the editor right in front of your eyes anyway.

------
randallsquared
I think "picture in your head" and "know well enough to go to the exact place
of any feature" are not the same thing. I can picture in my head a very small
number of lines of the code I usually write. Less than five, at any rate. But
maybe I misunderstand what you're asking.

~~~
palish
Unfortunately, the question can't be very specific. I've always been
fascinated by people who can clearly picture things in their mind.

For example, one time Woz accidentally deleted ColorMath, a program that Jobs
was going to show off at a trade show the very next day. Deleting it wasn't a
setback, because the code for ColorMath was "in his head". Presumably he was
able to sit down the next morning and rewrite ColorMath extremely quickly.

It seems like an artist can only be good if he can clearly visualize large
amounts of detail before touching a brush. Perhaps the best artists are ones
who can visualize the most detail.

In warfare, the best generals are the ones who can keep track of every single
nuance of the battlefield simultaneously.

The mind's eye seems to be important in every creative profession.

So this modest survey is an attempt toward figuring out what makes an artisan
excellent.

------
gnaritas
He was lying, no one who isn't a savant can remember 3 thousand lines of code
to the exact line. More likely he remember key lines where particular features
began.

~~~
tlrobinson
Ever heard of Kim Peek (<http://en.wikipedia.org/wiki/Kim_Peek>)? While he
doesn't memorize code, he remembers other equally impressive things.

There's an interesting documentary about him:
<http://www.youtube.com/watch?v=k2T45r5G3kA>

~~~
palish
That's fascinating. Thanks.

I wonder what kind of program he'd write, if he decided to learn programming.

------
nkohari
I think a better gauge is the number of features that you can keep in your
head, rather than the number of lines of code. (LOC doesn't always directly
correlate with complexity, anyway.) I'd say I can usually hold about 50% of
the features of the projects I usually work on in my day job without having to
do a "context switch". Usually, it's oriented around clear lines in the code
-- for example, the latest project I worked on had a program written for a
handheld computer with the .NET compact framework, a website written with
MonoRail and ExtJS, and a large data migration system. If I was working on the
website, I could typically answer questions quickly about most of the common
features in the handheld application. However, when asked about the more
complex aspects, it took me a few minutes to "page swap" the handheld code
into my brain. :)

