why is "self" used in OO-Python?
Roy Smith
roy at panix.com
Sat Jul 12 15:41:52 EDT 2008
In article <Xns9AD9C189C42A3duncanbooth at 127.0.0.1>,
Duncan Booth <duncan.booth at invalid.invalid> wrote:
> Sadly a lot of Java programmers mistake the limitations of their language
> for rules of OO programming, and worse this has spread from Java into other
> languages where these restrictions no longer need apply.
You can generalize that to, "a lot of programmers assume that OO is defined
by whatever happens to be the first OO language they learn".
In fact, it generalizes even further to the Law of Primacy
(http://en.wikipedia.org/wiki/Principles_of_learning#Primacy). I recognize
this drivel from the crud the FAA publishes:
> Primacy, the state of being first, often creates a strong, almost unshakable,
> impression. Things learned first create a strong impression in the mind that
> is difficult to erase. For the instructor, this means that what is taught
> must be right the first time. For the student, it means that learning must be
> right. ³Unteaching² wrong first impressions is harder than teaching them
> right the first time. If, for example, a student learns a faulty technique,
> the instructor will have a difficult task correcting bad habits and
> ³reteaching² correct ones.
but fundamentally, it's true. If the first programming language (or the
first OOPL) a person learns is Java, it should come as no surprise when
they think they way Java does things is the only way to do things. Having
seen no other ways yet, what else *could* they think?
I have no objection to teaching Java in a CS curriculum. Or even making it
the first language you teach. What I do object to is making it the ONLY
language you teach.
My next door neighbor's kid just finished a MSCS program. The curriculum
did a pretty good job of covering most of the important topics, but they
did it all in Java. Web development in Java, graphics programming in Java,
algorithms in Java, etc. He's well prepared to get a job as a Java
programmer (and, in fact, he did), but I don't think he's really trained to
be a computer scientist.
A good CS program should include a survey of different programming
languages. Today, I would certainly want to give students exposure to C++,
at least one of {Python,Ruby}, and a random sampling of some less main-line
languages like Erlang, Lisp, PHP, Groovy, Smalltalk, or PostScript.
Exactly which ones is not so important as getting to see a wide variety of
different approaches. Only after you've seen a bunch of different ways of
doing something can you start to appreciate the choices different language
designers made.
BTW, there's an interesting article in the July 2008 Computer Magazine: "In
Priase of Scripting: Real Programming Pragmatism". Ronald Loui argues
(amongst other things) that Python would make a good first language to
teach in a CS curriculum.
More information about the Python-list
mailing list