Live data from Hacker News

Holding a program in one's head

paulgraham.com

81–90 of 136 posts

Re: Holding a program in one's head

#81
Directly from IM in response to an interruption from my boss about an error message:

"I suspect there is an issue with the actual input from the database. (Note: we're working with a test database that's sketchy in spots) What do you want me to work on? Do you want me to spend the time tracking down that error or do you want me to work on "X" (that should have been done three weeks previous)? Because I was thinking about "X" and my entire train of thought is derailed and now I'm trying to work on "X" and wondering what is wrong with that particular chunk of data."

I suppose for the non-programmer it sounds like I'm just being nasty over nothing, but that little panic attack over a minor error message cost me HOURS in trying to get back to the original program in my head so I could finish it. In fact, I actually had to go and FIX the error to get it the hell out so I could fully focus on what I needed to be doing.

Once I got there, around 1am, the code flowed like water and it's done save for minor debugging. I was in the zone enough that if my eyes hadn't been closing by themselves, I'dve finished that, too.

Management, I think, has a double edged sword to deal with. My immediate boss wants to let me do what I do because I am lucky enough to have the ability to put someone else's code in my head in the same way described in this blog entry. It means that I can go in and fix it and if there's a bug I know why it's doing it and I know just where to push on it and where it needs shoring up--in short, after a while, it's like I wrote it myself.

But he's also dealing with HIS boss, who is dealing with the bottom line, and his boss would probably have apoplexy if he saw me playing spider solitaire as I let the problem I'm addressing work itself into my brain, and would have NO idea what I was talking about if I said I needed to get the application "into my head".

Wonderful blog entry.

Re: Holding a program in one's head

#82

I think you're right, except when it comes to what you say about brevity. I don't think it's important for a program to have a small text-footprint in order for it to be easily loaded into your brain. Why? Because it's the CONCEPTS behind the application code we're loading into our heads. It's not the text itself. So... if I have a program where I've formulated a class tree, it doesn't matter to the ease with which I…

This may be an advantage of design patterns: that they allow for a sort of brevity of class structure. You can think "ok, that's just the Composite Pattern there", and store it as one token in your short-term memory. Or at least fewer tokens. If your language let you, for example, use the Composite Pattern as a first class feature without having to code it every time, I'd bet your program would be easier to load into your head than one where you've got your own, new and possibly buggy, implementation of the pattern.

Re: Holding a program in one's head

#83
Great article. I seem to have no problem getting a program into my head, its getting it out that's the tough part. Its amazing how many times I've had to go somewhere else after work but end up driving the regular route home and get out of the car wondering how it was I got there. Scary.

Re: Holding a program in one's head

#84
post #74
post #73

Earlier quoted context omitted.

> What's good for YC is good for the country! It's not that unlikely. Since we had the luxury of doing whatever we wanted by the time we started YC, it stands to reason we'd do something beneficial instead of merely money-making.

It reads like a marketing pitch to acquirers -- "don't build, buy! Look at this one, a 2.0 webby thingamajig, ain't she a beaut? Only nine ninety nine nine nine nine ninety-nine. Hardly any miles!" Google sure seems to have a lot of success developing apps in-house, and due to integration requirements this makes a lot more sense in many cases. An outside party would simply be unable to provide an optimal solution in…

> Google sure seems to have a lot of success developing apps in-house

Bad choice of examples. Google is by far the biggest buyer of small startups. They just don't publicize it.

Re: Holding a program in one's head

#85
post #84
post #74

Earlier quoted context omitted.

It reads like a marketing pitch to acquirers -- "don't build, buy! Look at this one, a 2.0 webby thingamajig, ain't she a beaut? Only nine ninety nine nine nine nine ninety-nine. Hardly any miles!" Google sure seems to have a lot of success developing apps in-house, and due to integration requirements this makes a lot more sense in many cases. An outside party would simply be unable to provide an optimal solution in…

> Google sure seems to have a lot of success developing apps in-house Bad choice of examples. Google is by far the biggest buyer of small startups. They just don't publicize it.

Everyone wants to get acquired by Google, and yet it doesn't stop them doing their own stuff in-house. Unless AdSense, GMail, Calendar, News, Froogle, Video, Finance, etc. were bought instead of built.

Not to mention all the work that happened after they bought Keyhole et al.

Re: Holding a program in one's head

#86
post #85
post #84

Earlier quoted context omitted.

> Google sure seems to have a lot of success developing apps in-house Bad choice of examples. Google is by far the biggest buyer of small startups. They just don't publicize it.

Everyone wants to get acquired by Google, and yet it doesn't stop them doing their own stuff in-house. Unless AdSense, GMail, Calendar, News, Froogle, Video, Finance, etc. were bought instead of built. Not to mention all the work that happened after they bought Keyhole et al.

AdSense was at least partially an acquisition. Video became YouTube. Froogle is largely a failure. Considering how many programmers Google has your argument that they're good at producing stuff in-house is pretty weak. They're great at scaling and running stuff, but so far they don't seem to be very much better at creating new great things than any big company is.

Re: Holding a program in one's head

#87
post #71

Great points. They make me ask what PG thinks about unit tests: they seem to be like an exoskeleton allowing you to keep just a part of the program in your head. Or are they just a distraction?

In my case I found the latter.

I used to be excited about unit tests because of the promise of being able to make bolder changes to the code with certain confidence. And I feel the practice of making my code more testable improved my design skills.

But I found they are a maintainability issue too. They increased the cost of making the type of changes that would require me to change the tests- and normally, changes that don't break interfaces don't worry me a lot even if I don't have tests. Also, relying on the tests for a sense of confidence made me lazier about trying to really understand why the code worked. In general, it put my head in the mode of seeing the trees rather than the forest. YMMV.

Nowadays I write the code as if I was going to unit test it, and then I don't write the tests. When I do, I don't make much of a point of keeping them around; I use them basically as shortcuts to poking around in the REPL while I debug something. I try to keep things simple enough that not much can go wrong, I try to make sure I really understand how and why it works, and I try out most representative use cases I can think about.

That's enough to keep my debugging time quite low. When I do have bugs, I treat them as learning experiences: I try to understand why it happened and what can I do so I don't get more of those.

Re: Holding a program in one's head

#88
post #43

Earlier quoted context omitted.

Pg isn't speaking about programmers as in code monkeys, but about programmers as in hackers. Using other terminology to speak about programmers is not necessary, as programming shouldn't be disdained as an activity; you're probably better enhancing your terminology by going back to using the word "programming" without fear.

I'll grant you that. I suppose I wrote that response as a knee-jerk reaction to the twinge I get in my left shoulder every time I hear the word "programmer". I program and I code but I also paint and write but painting does not make me an artist and writing does not make me an author. Regardless, I agree with you after taking a breath and composing myself enough to slip back into regularity of terminology fearlessnes…

So you think painter and writer are derogative too?

Re: Holding a program in one's head

#89

I think you're right, except when it comes to what you say about brevity. I don't think it's important for a program to have a small text-footprint in order for it to be easily loaded into your brain. Why? Because it's the CONCEPTS behind the application code we're loading into our heads. It's not the text itself. So... if I have a program where I've formulated a class tree, it doesn't matter to the ease with which I…

Does it matter if you formulate your classes in assembly?

Re: Holding a program in one's head

#90
post #78

agree with most parts except for the use of perforce. most good programmers i know hate it, because it slows you down (as does subversion). git is the scm/vcs to use for doing feature experiments.

perforce (adverb):

    of necessity; necessarily; by force of circumstance.

http://dictionary.reference.com/browse/perforce
Post reply on HN