What is Expressiveness in a Computer Language

David Hopwood david.nospam.hopwood at blueyonder.co.uk
Sun Jun 25 01:06:58 CEST 2006


Marshall wrote:
> Joe Marshall wrote:
> 
>>Marshall wrote:
> 
>>>2) I want to run my program, even though it is broken, and I
>>>want to run right up to a broken part and trap there, so I can
>>>use the runtime facilities of the language to inspect what's
>>>going on.
>>
>>I do this quite often.  Sometimes I'll develop `in the debugger'.  I'll
>>change some piece of code and run the program until it traps.  Then,
>>without exiting the debugger, I'll fix the immediate problem and
>>restart the program at the point it trapped.  This technique takes a
>>bit of practice, but if you are working on something that's complex and
>>has a lot of state, it saves a lot of time because you don't have to
>>reconstruct the state every time you make a change.

The problem with this is that from that point on, what you're running
is neither the old nor the new program, since its state may have been
influenced by the bug before you corrected it.

I find it far simpler to just restart the program after correcting
anything. If this is too difficult, I change the design to make it
less difficult.

> Wow, interesting.
> 
> (I say the following only to point out differing strategies of
> development, not to say one or the other is right or bad or
> whatever.)
> 
> I occasionally find myself doing the above, and when I do,
> I take it as a sign that I've screwed up. I find that process
> excruciating, and I do everything I can to avoid it. Over the
> years, I've gotten more and more adept at trying to turn
> as many bugs as possible into type errors, so I don't have
> to run the debugger.
> 
> Now, there might be an argument to be made that if I had
> been using a dynamic language, the process wouldn't be
> so bad, and I woudn't dislike it so much. But mabe:
> 
> As a strawman: suppose there are two broad categories
> of mental strategies for thinking about bugs, and people
> fall naturally into one way or the other, the way there
> are morning people and night people. One group is
> drawn to the static analysis, one group hates it.
> One group hates working in the debugger, one group
> is able to use that tool very effectively and elegantly.
> 
> Anyway, it's a thought.

I don't buy this -- or at least, I am not in either group.

A good debugger is invaluable regardless of your attitude to type
systems. Recently I was debugging two programs written to do similar
things in the same statically typed language (C), but where a debugger
could not be used for one of the programs. It took maybe 5 times
longer to find and fix each bug without the debugger, and I found it
a much more frustrating experience.

-- 
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>



More information about the Python-list mailing list