When I'm writing code, and building something complicated,
there's this place I usually get to where I'm about to write "the hard line
Usually, I've just finished setting up a bunch of code to aggregate the data
I need both to read and update, getting the locks I need, and other
housekeeping chores, and now I're going to write the complicated bit of
arithmetic or really subtle conditional that's going to compute the outcome
value or decide whether to include the record or whatever the goal
I always pause involuntarily and lean back.
Then one of a few things happens:
- Most often, I realise that I haven't got
my data marshaled or resources locked or house generally kept properly, so I
have to back away and go back and do some refactoring.
The lesson here is that you often don't really understand the problem until
you write the code.
This is true both at the macro level (you can't fully understand the user
requirements until you start writing the code) and at the micro level (you
can't fully understand the data marshalling requirements until you write the
one short sequence of code that uses it all.
- Quite often, I stop and go get a coffee (or write a
note like this).
The actual reason for this is pure bone-laziness, my brain realises it's
about to be asked to really stretch out for a moment and interposes a
But I'm not sure it's a problem, often when I'm getting the coffee I suddenly
realize that I'm actually in situation #1 and I'm not quite ready to write
- I just write the code.
But almost never without recourse to one or both of the previous steps,
sometimes multiple times.
By Tim Bray.
I am an employee
of Amazon.com, but
the opinions expressed here
are my own, and no other party
necessarily agrees with them.
A full disclosure of my
professional interests is
on the author page.