[Edu-sig] Re: Best approach to teaching OOP and graphics

David Handy david at handysoftware.com
Sat Mar 26 22:51:26 CET 2005

On Sat, Mar 26, 2005 at 11:18:47AM -0500, Jeffrey Elkner wrote:
> On Sat, 2005-03-26 at 12:08 +0200, Linda Grandell wrote:
> > I dived right into your lessons... Looks *very* good.

I have to echo that sentiment. Jeff, your approach is excellent.  Test
Driven Development really works, I've proved that myself.

But what I'm also impressed with is that you gave the students series of
tests to pass, each one adding more functionality. You are teaching your
students *incremental* development, which is extremely important IMO.

> I wanted to find a way to use this approach throughout the course, but the
> existing testing frameworks always got in the way.
> DocTest has changed all that.

That has been my experience exactly.

Speaking of making good use of doctest, I did a presentation recently at the
Triangle Zope/Python user's group (TriZPUG) on Python's new-style classes. I
wanted to demonstrate the features using an interactive Python session, but
I didn't trust myself not to be too nervous to type the commands right.

So I created a module called demotest that does the same thing as doctest,
except that it prints each command and response, and it waits for me to
press Enter before going on to the next line. I just put:

    if __name__ == '__main__':
        import demotest
at the bottom of my example module and it steps me through my demonstration.

If this sounds interesting, here is the link to the notes from my


and here is a direct link to my demotest module:


Maybe someone else will find it as useful as I did. It requires Python 2.4
because it uses the "advanced" doctest API: it uses DocTestFinder and
extends DocTestRunner.

David H.

----- End forwarded message -----

More information about the Edu-sig mailing list