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

Jeffrey Elkner jeff at elkner.net
Sat Mar 26 17:18:47 CET 2005


On Sat, 2005-03-26 at 12:08 +0200, Linda Grandell wrote:
> I dived right into your lessons... Looks *very* good. I am always 
> looking for "new" approaches to teaching programming, since this is the 
> very topic of my future PhD-thesis. Giving the students a "standard" 
> which there programs are to meet should indeed be very motivating and 
> pose a positive challenge to all students. My class starts in three 
> weeks, so I have some time (not much :) to try out doctest on my own and 
> see if it would be suitable for my students. 

Please note, Laura, that I used doctest in more complicated way than
needed.  *All* you need to do to use doctest is add this to the bottom
of your file:

if __name__ == "__main__":
    import doctest
    doctest.testmod()

Then you simply run the module from the command line, and your testing!

> Did your students find it difficult to learn and start implementing TDD?

Absolutely not.  They found it as natural as can be.  I've been hanging
around an eXtreme Programming user's group for several years now, and I
wanted to find a way to use TDD in the classroom.  I had a wonderful
experience with it two years back (see
http://www.elkner.net/jeff/testFirst/index.html), and 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.  It is not hard to understand why this is
so if you look at Tim's description of why he created DocTest:

http://c2.com/cgi/wiki?DocTest

Tim has done a brilliant job of creating a testing mechanism that is
completely natural to python.  Students have no difficulty using it,
since it mirrors the way they were informally testing previously.

> Have you considered using this approach in the exam? One thought that 
> came to mind would be to make the grades depend on which test cases the 
> programs pass. The test cases could be divided into groups, and in order 
> to pass the tests in the "higher grade"-groups, the programs would have 
> to be more flexible, advanced and so on than programs passing the basic 
> test cases. In this way  the same task could be challenging for all 
> students. Finding suitable exam questions can, in my opinion, sometimes 
> be really tricky, especially when there is great variation in the 
> students' programming skills.

Great idea.  I want to work on a python testing program (probably using
Zope3) that works this way.  If you are interested in the same type of
thing, perhaps we could work together?

jeff elkner




More information about the Edu-sig mailing list