[Python-talk] Programming methods (was: Oops! Fallen off the track)
Ben Scott
dragonhawk at gmail.com
Sun Jul 19 12:29:36 EDT 2009
On Sat, Jul 18, 2009 at 7:57 PM, Ric Werme<ewerme at comcast.net> wrote:
> I haven't gotten much beyond "objects are just like C structs that have
> pointers to subroutines." This drives OO zealots batty for reasons
> I haven't quite figured out.
OO zealots (and programming language zealots of other kinds) often
loose sight of the fact that anything you can do with a computer can
be expressed in terms of machine code. Any programming paradigm is
thus fundamentally just a compiler feature wrapped around machine
code. Machine code is unstructured, imperative, weakly typed -- all
those things we're usually trying to get away from. Anything that
reminds zealots that their chosen religion isn't much more than
syntactic sugar insults their sense of holy cleanliness.
So, yah, internally, OO generally isn't anything more than C structs
with pointers to subroutines, provided you provide your own
implementation of things like inheritance, method overrides, virtual
methods, run-time typing, etc.
The advantage is the compiler knows about it, so it can do all that
drudgery for you, and enforce certain aspects to prevent some kinds of
mistakes. Plus metaphors like "object", "class" and "message" help
structure our thinking, which generally increases programmer
understanding.
> ... we've lost ... list file output had machine code, cross
reference lists, subtitles you could change as appropriate, etc.
These days, that's typically done instead with IDEs which allow you
to cross-reference and analyze the source interactively. It's akin to
hypertext. It's certainly faster than chasing cross-references by
flipping pages. :)
-- Ben
More information about the Python-talk
mailing list