Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   teaching OO (http://www.velocityreviews.com/forums/t338425-teaching-oo.html)

Gabriel Zachmann 11-24-2004 08:48 AM

teaching OO
 
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 ;-).)

Interested in all kinds of thoughts.

Best regards,
Gabriel.

--
/-------------------------------------------------------------------------\
| There are works which wait, |
| and which one does not understand for a long time; [...] |
| for the question often arrives a terribly long time after the answer. |
| (Oscar Wilde) |
+-------------------------------------------------------------------------+
| zach@cs.uni-bonn.de __@/' www.gabrielzachmann.org |
\-------------------------------------------------------------------------/

Rob Snyder 11-24-2004 02:29 PM

Re: teaching OO
 
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 ;-).)
>
> Interested in all kinds of thoughts.
>
> Best regards,
> Gabriel.
>


Gabriel -

I was in a similar position, and decided to make the change over to Python
completely. Key for me was that I knew these same students, at some point
in time, would *also* being taking several courses that involved C++. In
other words, they didn't need this course to cover C++, they only needed it
to get introduced to OO programming, and by switching to Python, I gave
them an environment to learn that they could really get their heads around.

If the students wouldn't be getting immersed in C++ otherwise, I don't think
I would have made the switch, and may have continued not using any Python
at all.

Python, IMHO, is an excellent teaching language. In my observations, by
switching to Python for the OO concepts class, I'd say we easily covered
50% more material in the same amount of time.

As for the interesting C++ issues, those same students were able to pick
those concepts up quickly in their later classes. "Overloading", for
example, was a pretty simple concept to grasp for people who had previously
spent a whole semester heads down learning OO.

Rob

Neil Benn 11-24-2004 04:21 PM

Re: teaching OO
 
<snip>

>As for the interesting C++ issues, those same students were able to pick
>those concepts up quickly in their later classes. "Overloading", for
>example, was a pretty simple concept to grasp for people who had previously
>spent a whole semester heads down learning OO.
>
>Rob
>
>

Hello,

Just out of interest, did the students get confused between
polymorphism acheived through duck-typing and polymorphism acheived
through inheritence. Obviously not all OO languages have duck typing
and they are subtly different concepts which may confuse a learner.

Just a question, I'm not in education so I wouldn't know the best
way to perform structured education (my teacher friends remind me of
this all the time!!).

Cheers,

Neil

--

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 47
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : benn@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com


Rob Snyder 11-24-2004 05:00 PM

Re: teaching OO
 
Neil Benn wrote:

> <snip>
>
>>As for the interesting C++ issues, those same students were able to pick
>>those concepts up quickly in their later classes. "Overloading", for
>>example, was a pretty simple concept to grasp for people who had
>>previously spent a whole semester heads down learning OO.
>>
>>Rob
>>
>>

> Hello,
>
> Just out of interest, did the students get confused between
> polymorphism acheived through duck-typing and polymorphism acheived
> through inheritence. Obviously not all OO languages have duck typing
> and they are subtly different concepts which may confuse a learner.
>
> Just a question, I'm not in education so I wouldn't know the best
> way to perform structured education (my teacher friends remind me of
> this all the time!!).
>
> Cheers,
>
> Neil
>


Neil -

At first, yes. What I found quite interesting was that most students seemed
to naturally think that duck typing was the only "sensible" way things
should work, and later, when faced with C++, they did often stumble.

I am more careful now to seperate the Python way of doing things from the
general theory behind inheritance, interfaces, and class types, and I try
to cover up front how a lot of the rest of the world works.

Regards,

Rob

Ian Bicking 11-24-2004 06:02 PM

Re: teaching OO
 
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@colorstudy.com / http://blog.ianbicking.org

Ville Vainio 11-24-2004 06:12 PM

Re: teaching OO
 
>>>>> "Gabriel" == Gabriel Zachmann <zach@cs.uni-bonn.de> writes:

Gabriel> My question now is: do you think I should switch over to
Gabriel> Python completely (next time), and dump all the
Gabriel> interesting issues involved in C++'s virtual classes,
Gabriel> overloading, and templates? (In Python, all of that would
Gabriel> just disappear ... ;-) )

I don't think virtual classes (as in inheriting from base classes
"virtually" to avoid a certain multiple inheritance problems) is all
that important in this single inheritance favouring world.

The concept of overloading is easy, you can go one step further by
introducing generic functions / multimethods through one of the
modules floating around the net.

--
Ville Vainio http://tinyurl.com/2prnb

Gabriel Zachmann 11-24-2004 06:31 PM

Re: teaching OO
 
Thanks a lot for your response and sharing your thoughts.

> I think it's
> clear the future of programming won't look like C++. It won't


You know, I keep wondering exactly what we will be teaching as programming
languages become easier and easier to learn.

Programming itself? -- won't be enough for a whole semester.
Algorithms? -- is and will be a whole different class.
Patterns? -- needs too large programming assignments.
....


> 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.


I learnt OO the smalltalk way, and i loved it.
But i program a lot in C++ and i do like it, too.

Another question is: can you teach effectively the inner workings, if you
teach only a dynamic language?


Best regards,
Gabriel.

--
/-------------------------------------------------------------------------\
| There are works which wait, |
| and which one does not understand for a long time; [...] |
| for the question often arrives a terribly long time after the answer. |
| (Oscar Wilde) |
+-------------------------------------------------------------------------+
| zach@cs.uni-bonn.de __@/' www.gabrielzachmann.org |
\-------------------------------------------------------------------------/

Gabriel Zachmann 11-24-2004 06:38 PM

Re: teaching OO
 
> Just out of interest, did the students get confused between
> polymorphism acheived through duck-typing and polymorphism acheived


i haven't gotten so far yet.
and this semester, i won't do everything in parallel.

But I can say that it is very convincing to explain dynamic typing vs.
static typing, and weakly typed vs. stringly typed by contrasting how
things work in python vs how they work in c++.

> way to perform structured education (my teacher friends remind me of


hm, i'm not an educated teacher, just an assistant professor --
could you please explain to me what "structured education" means? ;-)

Cheers,
Gab.

--
/-------------------------------------------------------------------------\
| There are works which wait, |
| and which one does not understand for a long time; [...] |
| for the question often arrives a terribly long time after the answer. |
| (Oscar Wilde) |
+-------------------------------------------------------------------------+
| zach@cs.uni-bonn.de __@/' www.gabrielzachmann.org |
\-------------------------------------------------------------------------/

Gabriel Zachmann 11-24-2004 06:42 PM

Re: teaching OO
 
> I don't think virtual classes (as in inheriting from base classes
> "virtually" to avoid a certain multiple inheritance problems) is all
> that important in this single inheritance favouring world.


ah, sorry, i meant "classes with virtual methods" (i.e., classes that have
RTTI).

> The concept of overloading is easy, you can go one step further by
> introducing generic functions / multimethods through one of the
> modules floating around the net.


You mean in Python? (or C++)
Could you give me a pointer to one of those modules?

TIA,
Gab.


--
/-------------------------------------------------------------------------\
| There are works which wait, |
| and which one does not understand for a long time; [...] |
| for the question often arrives a terribly long time after the answer. |
| (Oscar Wilde) |
+-------------------------------------------------------------------------+
| zach@cs.uni-bonn.de __@/' www.gabrielzachmann.org |
\-------------------------------------------------------------------------/

Gabriel Zachmann 11-24-2004 06:45 PM

Re: teaching OO
 
> If the students wouldn't be getting immersed in C++ otherwise, I don't think
> I would have made the switch, and may have continued not using any Python


ah, here they won't necessarily be confronted with c++ any more.
more likely java.
and they won't have any dedicated programming classes at all any more.

Cheers,
gab.


--
/-------------------------------------------------------------------------\
| There are works which wait, |
| and which one does not understand for a long time; [...] |
| for the question often arrives a terribly long time after the answer. |
| (Oscar Wilde) |
+-------------------------------------------------------------------------+
| zach@cs.uni-bonn.de __@/' www.gabrielzachmann.org |
\-------------------------------------------------------------------------/


All times are GMT. The time now is 05:06 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.