Pages

A blog about teaching Programming to non-CompSci students by Tim Love (Cambridge University Engineering Department). I do not speak on behalf of the university, the department, or even the IT group I belong to.

Wednesday, 27 April 2011

Teaching O-O

We teach using Matlab and C++ so we could teach programming in an Object-Oriented way. Post-2008, Matlab's O-O support has become neater, and has more features - listeners; something similar to Java's final, etc, but we don't talk about that aspect of Matlab. Undergraduates define their own C++ classes in the 1st year, but only in an optional 3rd year course do they really get introduced to O-O. There's not really enough time to push multi-paradigm programming at them. They would end up forgetting how to write loops, or whether arrays begin at 0, and they'd more often do things like getting programs to print the final results by putting the output code into a destructor, or using objects merely to modularise code.

In a way you might think engineering suits O-O - re-usable components and interfaces are common to both fields - but engineers also know about K.I.S.S. and over-engineering.

In "Python for Teaching Introductory Programming: A Quantitative Evaluation" (Jayal et al; Italics V.10.1 Feb 2011) they say they "found four experimental studies that compare object oriented approach with the traditional procedural approach". One "by Reges (2006) has found significant gains in student satisfaction and enrolment after replacing the object oriented programming first curriculum with a procedural approach". The other 3 studies found no significant differences. Jayal et al. found that students who started with Python then did Java performed better than students who did Java all the way through the course.

In Back to Basics in CS1 and CS2, Stuart Reges says "Our new version of CS1 looks a lot like a 1980's course taught in Pascal. We have gone back to procedural style programming. I was motivated to do this after attempting and failing to teach a broad range of introductory students at the University of Arizona using an 'objects early' approach. I found that my best students did just fine in the new approach, but the broad range of midlevel students struggled with the object concept". The course begins by using Java with a lot of public static methods. He writes "Our switch to static methods has allowed us to bring back the problem solving aspects of the course that we thought were so important in the 1980's" adding that "even though Java is not an ideal choice for our CS1, we continue to use it because of its payoff in our CS2 course."

If that reasoning applies in a Computer Science course it applies even moreso to Engineering, I'd have thought. So should O-O stand for "Objects-Overrated"?

No comments:

Post a Comment