whoops, sent this reply off-list by accident (apologies to Scott)

----

Here's a thought that just jumped into my mind, I don't know if it has
any value, but bear me out:

I think it probably makes most sense to introduce programming to totally
new people in a procedural/structured/whatever you want to call it way.
My feeling is that most people who haven't done any programming think of
a computer program as a big list of instructions for what to do, and
this model should be pretty easy to introduce to them.

Now you start to try to do more compliated things, and you have to start
accumulating global state so that your many functions can do meaningful
things without having to pass loads of arguments around. Pretty soon,
depending on the topic, you probably want a way to group global
variables together -- the first approach might be to name them
similarly, like foo_bar and foo_baz for bar and baz relating to foo. But
what if you have two different things of type foo?

Now introduce objects as essentially structs. You have a class
definition, like:

class Foo:
 bar = someDefault
 baz = someDefault

and just work with that for a while. Now, you are passing around Foo's
as arguments to your functions, and you realize that certain functions
can only work on Foo's, while others can only work on OtherThing's.
Isn't it logical to group your functions in the same way as your
variables? Oh, look, thats object-orientation (or the core of it), and
you got there all on your own.

My experience as a student has been that the best teachers are the ones
who give you all but the conclusion, and let you make the final leap
yourself. That, I think, makes the knowledge both more likely to stick,
and the excercise (which is probably at least somewhat artificial, as
most exercies tend to be) more exciting, as you feel like you're making
a new contribution to how it all works.

Anyway, that's roughly how I had been introduced to OO programming over
the years: first BASIC, learning the, well, basics, of program
organization with sub's; next, larger scale programs, maybe in C,
organizing static members and functions into files; soon structs; then
full-on OO with Java (which I loathe), and later Python and C++.

Just my $0.02

dsc

_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to