KBD

Keith Devens .com

Monday, December 1, 2008 Flag waving
Nonsense on stilts! – Derived from Jeremy Bentham
← PyMeldFact checking Dave Winer →

Daily link icon Friday, May 9, 2003

Writing broken programs

Don't you hate it when you write a whole bunch of code without compiling or running it at intermediate steps, usually because it's a big thing that really doesn't do anything unless it's complete? For example, an involved recursive algorithm, where unless all the parts are integrated correctly, and data is returned correctly at each invocation, you don't get anything at the end Smiley So now I'm about to hit compile and watch everything blow up at me, and I'm about to go through that inevitable frustration where after a while you think it's working, and then you find yet another bug.

Paul Graham, however, thinks this is the most natural way to program. He doesn't mind at all:

For example, I was taught in college that one ought to figure out a program completely on paper before even going near a computer. I found that I did not program this way. I found that I liked to program sitting in front of a computer, not a piece of paper. Worse still, instead of patiently writing out a complete program and assuring myself it was correct, I tended to just spew out code that was hopelessly broken, and gradually beat it into shape. Debugging, I was taught, was a kind of final pass where you caught typos and oversights. The way I worked, it seemed like programming consisted of debugging.

For a long time I felt bad about this, just as I once felt bad that I didn't hold my pencil the way they taught me to in elementary school. If I had only looked over at the other makers, the painters or the architects, I would have realized that there was a name for what I was doing: sketching. As far as I can tell, the way they taught me to program in college was all wrong. You should figure out programs as you're writing them, just as writers and painters and architects do.

I like debugging: it's the one time that hacking is as straightforward as people think it is. You have a totally constrained problem, and all you have to do is solve it. Your program is supposed to do x. Instead it does y. Where does it go wrong? You know you're going to win in the end. It's as relaxing as painting a wall.

I really like his philosophy... "you know you're going to win", therefore it should be relaxing.

← PyMeldFact checking Dave Winer →

Comments XML gif

Dinx (http://www.jkdev.de) wrote:

Programming alá Trial-and-Error. Great.

Don`t get me wrong - i DO know that one can`t plan EVERYTHING beforehand. But to me that comment sounded like .... "I´ll try something - and i know it will be working". And it WILL work mostly.

But I`d rather stick to the paradigm of "Think first" .....

∴ Dinx | 10-May-2003 9:10pm est | http://www.jkdev.de | #2052

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

December 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

new⇒Free image hosting sites

Well, TinyPic has this in its​FAQ:

> Images and videos is in​your accoun...

Keith: Dec 1, 1:13am

Join a NameValueCollection into a querystring in C#

Well with a lamba expression, this​is what I came up​with:

?!code:csharp...

Gustaf Lindqvist: Nov 30, 4:38pm

Why no generic OrderedDictionary?

Check​http://www.codeproject.com/KB/recip​es/GenericOrderedDictionary.aspx?d...

Gabrielk: Nov 27, 6:57am

WhatIsMyIP.com

http://www.thesysteminfo.com is​another good alternate to​whatismp.com... I...

Kripz: Nov 26, 8:51pm

Girls, please don't get breast implants

Actually I think it's sweet when a​man loves a woman whether she's big​or n...

218.186.12.228: Nov 26, 9:40am

Generated in about 0.183s.

(Used 8 db queries)

mobile phone