[Edu-sig] Teaching OOP: Lending your "I"

Kirby Urner pdx4d@teleport.com
Thu, 06 Jul 2000 00:44:18 -0700


One effective way to impart the OOP viewpoint is to 
have students learn to "empathize" with objects, 
meaning you look at some instantiation of class X
and say "I am an X".  This helps synch with the 
grammar of "self", the first parameter in all 
object methods.

When you come across syntax like:

obj2 = module.objX() 

learn to think "I am an objX, my name is obj2.
I know how to [method].  I inherit additional
know-how from my parent, objY."

You can learn "empathy" independently of any 
coding.  For example:  "I am a valve.  I open
and close.  When I'm open for a long time, I
know how to send a reminder to ControlPanel 
that I'm still open."  Or:  "I am a weather
pattern.  I have a beginning, middle, and end,
in relation to a time line.  I have a lot of
parameters and methods."

The goal of such lingo is to instill a sense
of encapsulation, as well as a sense of 
responsibility in the logical sense, i.e. 
a well-designed object has a definite role to
play in some ensemble of objects.  Learning to
"empathize" with each object in turn helps you
conceptualize about these roles.

Kirby