Holding a Program in One's Head (2007)
51–60 of 114 posts
Re: Holding a Program in One's Head (2007)
#52Take a look at the list of people who read the draft of this post. > Thanks to Sam Altman, David Greenspan, Aaron Iba, Jessica Livingston, Robert Morris, Peter Norvig, Lisa Randall, Emmett Shear, Sergei Tsarev, and Stephen Wolfram for reading drafts of this.
Re: Holding a Program in One's Head (2007)
#53I more or less agree with the main thesis although I would point out that typical software development practices in industry make this very difficult. Fred Brooks told us to plan to throw out the first draft. Industry says ship it.
Re: Holding a Program in One's Head (2007)
#54Re: Holding a Program in One's Head (2007)
#55Earlier quoted context omitted.
> wouldn't be a bug if everything was happening exactly according to expectations This isn't quite true, especially concerning distributed systems. It's relatively common for a software system to be broken by design . It's not that the developer didn't know how to use the programming language to get the computer to do what they want. It's that what the developer wanted reflects a poor model of the world, a logical in…
That sounds distinctly like an expectation that didn't hold.
Re: Holding a Program in One's Head (2007)
#56Earlier quoted context omitted.
That’s why I learned to log literally everything into stdout unless a process is time-sensitive and it’s deep production and it passed the mark where bugs and insights occur once a month+ and there’s zero chance someone asking me what exactly happenes with X at Y afternoon-ish last Friday. The obvious exception are recursive number-fiddling algos which would spam gigabytes of output due to big N. This way I can just…
For large systems the cost of maintaining all of those logs in a searchable system can be prohibitive.
Re: Holding a Program in One's Head (2007)
#57> You never understand other people's code as well as your own. No matter how thoroughly you've read it, you've only read it, not written it. There is certainly some truth to this. On the other hand, it's possible to become blinded to defects in code you've written yourself. You see what you intended for the code to do rather than what it actually does. Reading someone else's code, it can be easier to see what's real…
The comparison with mathematics also makes sense here. It’s much easier to spot typos in other peoples’ work than your own for exactly that reason: when you read back what you wrote, you read back what you meant to write rather than what’s actually there. Open any textbook (even a fourth edition of a famous one, written by an expert) and you’ll find countless typos. In fact, in a certain sense, the more expert you ar…
Re: Holding a Program in One's Head (2007)
#58> You never understand other people's code as well as your own. No matter how thoroughly you've read it, you've only read it, not written it. There is certainly some truth to this. On the other hand, it's possible to become blinded to defects in code you've written yourself. You see what you intended for the code to do rather than what it actually does. Reading someone else's code, it can be easier to see what's real…
There's some idiom that says something like "you don't understand something if you can't explain it." I think this is the real point of code review. To make a case for why your code is valuable. If it's just a blob of 1000 lines of "refactor" or "adding feature." It means nothing. A good commit has some kind of abstract tailored to what work was done. Then a review becomes something like "the claim was made this func…
Re: Holding a Program in One's Head (2007)
#59A good way to keep a program in your head: Break it up into a few or several smaller programs that interact through clean interfaces. Then you can keep one smaller, simpler program in your head at a time, then integrate them at the end once all the smaller programs are working.
Those are called functions.
Sometimes it is one or more programs writing to a queue or topic, and other programs reading from that topic.
Or programs writing to and others reading from a Unix pipe.
Or programs talking to each other using HTTP.
Or Erlang processes communicating concurrently on one machine or across a network.
Or different programs sharing one database.
Or many objects communicating by passing messages in a small talk program.
There are many ways to encapsulate programs and have them interact.