teaching OO

Ian Bicking ianb at colorstudy.com
Wed Nov 24 13:02:12 EST 2004


Gabriel Zachmann wrote:
> This post is not strictly Python-specific, still
> I would like to learn other university teachers' opinion.
> 
> Currently, I'm teaching "introduction to OO programming" at the undergrad
> level. My syllabus this semester consists of a bit of Python (as an example
> of a scripting language) and C++ (as an example of a compiled language).
> With C++, I go all the way up to meta-programming.
> 
> My question now is: do you think I should switch over to Python completely
> (next time), and dump all the interesting issues involved in C++'s virtual
> classes, overloading, and templates? (In Python, all of that would just
> disappear ... ;-) )
> 
> (The opinion of the people on this NG might well be a little bit biased
> towards Python, but that's ok ;-).)

Well, I haven't taught Python (though I think it would be fun to try 
sometime), so you can take my opinion as you will.  But, if I was 
judging languages I'd find Python's advantage to be primarily the 
simplicity of the interface and tools.  With Python you don't have to 
spend (much) time learning the tools, or even the library; students in 
many intro CS classes seem to spend a lot of time getting *anything* to 
work, and it keeps them from getting to the interesting programming 
problems.  I also think OO and other programming methodologies become 
more relevent when you are faced with significant design challenges, and 
intro programmers won't ever be able to make a significant program in a 
C++ class.

More generally, I think a good class is one that gives the students many 
opportunities for making mistakes.  Ideally every student would make 
many, many mistakes -- no matter their skill.  More skilled students 
should simply be making more ambitious projects, and failing at a more 
advanced level.  From this perspective, simply making programming fun is 
particularly important, because if it's not fun the students won't press 
themselves to the limit of their skills, they'll only be doing the 
prescribed work.  And Python is more fun.

 From a CS perspective, I'd obviously (since this is a partisan forum) 
say that Python presents the core concepts of OO better than C++.  But I 
actively disagree with the core concepts of OO as defined by most C++ 
academics, really falling into the Smalltalk camp; treasuring 
flexibility and cooperation of systems over formalism and encapsulation. 
  In many ways the result can be the same -- the objects and methods and 
interactions of similar systems may look the same across these 
langauges.  But I prefer the carrot (the potential to make a great 
program) over the stick (the inability to use code in ways the initial 
programmer did not intend).  This philosophy of transparency and 
no-boundry refactoring is also fundamental to the free/open source 
software community, which I honestly see as fundamentally (if sometimes 
subtley) different from proprietary development; it's not just a matter 
of license.

Anyway, I see many C++-specific OO notions (like templates, by-reference 
vs. by-value calling, etc) as coping mechanisms.  This is because I come 
at it from the perspective of a dynamic language programmer (before 
Python I preferred languages like Scheme or Smalltalk).  These 
judgements are something a programmer acquires early on.  Conversely, if 
you start with C++ or C, you might see a dynamic language as a facade 
ontop of the more fundamental notions of pointers and memory management. 
  Certainly people drift, and one class won't set a person's perspective 
in stone, but it's important.  At the same time, the students are young 
-- you aren't training them for what is, but what will be.  I think it's 
clear the future of programming won't look like C++.  It won't 
necessarily look like Python either; Java and C# fall somewhere in 
between; they appear somewhat like C in syntax, but you have to 
remembering that they too don't have manually memory management, 
templating, heavily-used overloading, or pointers.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org



More information about the Python-list mailing list