[plt-scheme] debugging [mini rant]

From: Mike Eggleston (mikeegg1 at mac.com)
Date: Wed Jul 29 08:19:57 EDT 2009

On Wed, 29 Jul 2009, Jens Axel S?gaard might have said:

> 2009/7/29 Paulo J. Matos <pocmatos at gmail.com>:
> > On Wed, 2009-07-29 at 00:23 +0200, Jens Axel Søgaard wrote:
> >> 2009/7/28 Paulo J. Matos <pocmatos at gmail.com>:
> >> > On Tue, 2009-07-28 at 16:12 -0500, Mike Eggleston wrote:
> >>
> >> >> Is there a command line debugger in mzscheme?
> >>
> >> > - Is a command line debugger planned?
> >>
> >> I am curious, do you use debuggers in other programming environments?
> >> If so, in which situations do you find them useful?
> >>
> >
> > Yes, I use gdb a lot with C and C++. I find them very useful to step
> > through some piece of code which is generating a strange value.
> Is this faster than sprinkling the code with print statements?

Yes, much, and preferable in a production environment when you're
trying to figure out why something is not right. Any change you make
to the code must be tested again, so if you can run the code through a
debugger without changes is best. If you make a change to add printf()s
then you can't say for certain if your printf() caused the error or if
you've found the reported error.
> > For me they are particularly useful when debugging algorithms that
> > either involve a lot of mathematics or which has a complex flow.
> For the first purpose (mathematical expressions) I see that as sign to
> break down the function into smaller ones, and then write a few tests
> for each.
> The second, well it takes ages to follow complicated flows in a
> debugger, so for me I have found testing each component independently
> usually is faster.
> -- 
> Jens Axel Søgaard

I agree with smaller and testing first. That's how I learned java, through
a very liberal use of System.out.println() throughout my code. I'll learn
scheme the same way if I need to (still working on the learning part),
but using something like 'perl -d' for an integrated, embedded source
line debugger would be much faster.


Posted on the users mailing list.