Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: mch24@cam.ac.uk (Martin Harvey)
Subject: Re: [++] Tight coding
Date: 1998/03/02	[thread overview]
Message-ID: <6dfbs3$95g$1@lyra.csx.cam.ac.uk> (raw)
In-Reply-To: slrn6fk0pe.5t2.peter@eepjm.newcastle.edu.au


Verily, peter@eepjm.newcastle.edu.au (Peter Moylan) spake thus:

>I'm constantly amazed at the way the OO paradigm has taken
>over so many minds.  In my experience it's great for toy
>programs, but gives you a complexity blow-out on any
>reasonable-sized project.  Admittedly a lot of my OO experience
>comes in conjunction with using the Microsoft Foundation
>Class library, which seems to have been designed expressly
>for the purpose of convincing people that OO libraries are
>evil.  Nevertheless, I am still not convinced that there's
>a good way to use OO techniques in conjunction with clean
>programming practices.

Peter,

While you post plenty of excellent advice... I am slightly inclined to
disagree here....!

I find that OO libraries, when well written, can be great for reducing
complexity. However... the reason that they introduce additional
complexity is because of the subtleties involved in inheritance and
polymorphism. They seem like fairly simple concepts, but when applied
on a large scale, they can do very odd things. I think the secret to
OO programming is to think everything through well in advance. From my
experience, OO architectures can be great for data hiding and
abstraction, but they really don't like ad-hoc solutions or
modification. You can do lots of really subtle and neat things
(especially when using "advanced" OO techniques, such as metaclasses,
polymorphic construction etc etc....) and some of these techniques are
very powerful, but one has to design elegantly. Alas... to many C++
programmers from a C background..... <g>

To be honest, having recently gone back to M-2 (for a few weeks)
having used Delphi, I was amazed at how simple everything was.

I have to confess that I found OO and event driven programming so
neat, then when writing my Modula-2, I ended up using opaque and
abstract data types loads, and started writing code with loads of
callbacks in, to make my M-2 stuff "event driven (see IRC via DOS
post!).

I suspect that OO programming is very powerful... but can be badly
misused. I've just written about 15,000 lines of Delphi communications
code, all of which is message based and asynchronous. I wouldn't have
been able to write it at all in a non OO paradigm (involving as it
does implementing distributed OO protocols), and it is an order of
magnitue more powerful than anything I could have written in M-2 or C
given the same limit on code size. However, it's just too easy to get
things wrong if you start using OO code that you 1) Didn't write, 2)
don't fully understand, or 3) is poorly documented, because OO
introduces subtlety in everything you do ...

eg. MyObject.DoFoo(SomeObject:TObject);

A simple method call to an object, supplying another object.

Simple right?

Wrong.

1. The method may be virtual... and thus call various other methods.
2. The parameter may be of any object type descended from TObject,
this call may call some of "SomeObjects" methods, which may in turn be
virtual, and call other methods back in the original MyObject....
which may be virtual & overriden etc etc. I've seen simple method
calls like this do the most wierd and wonderful things ... 

anyway... I've run out of energy for today ... so that's my $.02.

MH.




  reply	other threads:[~1998-03-02  5:00 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-23  5:00 Wildfire and NT Robert Harley
1998-02-24  5:00 ` brianh
1998-02-24  5:00   ` Sean Burke
1998-02-25  5:00     ` [++] Tight coding (Was: Re: Wildfire and NT) Terje Mathisen
1998-02-28  5:00       ` Piercarlo Grandi
1998-03-01  5:00       ` [++] Tight coding Bill Moyer
1998-03-01  5:00         ` Ruud Bruijnesteijn
1998-03-01  5:00           ` scott
1998-03-02  5:00             ` Martin Tom Brown
1998-03-02  5:00             ` Terry Moore
1998-03-02  5:00               ` Kaz Kylheku
1998-03-02  5:00               ` Pete Becker
1998-03-03  5:00                 ` Ruud Bruijnesteijn
1998-03-03  5:00                   ` Pete Becker
1998-03-04  5:00                     ` Terry Moore
1998-03-03  5:00                       ` Pete Becker
1998-03-04  5:00                       ` Ruud Bruijnesteijn
1998-03-02  5:00             ` Kaz Kylheku
1998-03-01  5:00         ` Larry Kilgallen
1998-03-01  5:00           ` [++] Tight coding (comp.sys.dec-only thread) Bill Moyer
1998-03-02  5:00         ` [++] Tight coding Peter Moylan
1998-03-02  5:00           ` Martin Harvey [this message]
1998-03-02  5:00           ` Lawrence Kirby
1998-03-02  5:00             ` Peter Moylan
1998-03-02  5:00               ` Ketil Z Malde
1998-03-04  5:00                 ` Lyn A Headley
1998-03-02  5:00               ` Kaz Kylheku
1998-03-03  5:00               ` Lawrence Kirby
1998-03-02  5:00           ` Kaz Kylheku
1998-03-02  5:00           ` Scott Fluhrer
1998-03-03  5:00           ` Larry Kilgallen
1998-02-25  5:00     ` Wildfire and NT Mike Albaugh
1998-02-25  5:00     ` Maynard Handley
1998-02-25  5:00     ` brianh
1998-02-24  5:00   ` David Hinds
1998-02-25  5:00     ` Del Cecchi
1998-02-25  5:00     ` brianh
1998-02-24  5:00   ` Bill Moyer
1998-02-25  5:00     ` Larry Kilgallen
1998-02-25  5:00       ` brianh
1998-02-25  5:00         ` Epiphanies (was: Wildfire and NT) Carlie Coats
1998-02-25  5:00     ` Wildfire and NT John Hascall
1998-02-25  5:00       ` Rob Rodgers
1998-02-25  5:00   ` Bernd Paysan
1998-02-25  5:00     ` brianh
1998-02-26  5:00       ` Bernd Paysan
1998-02-27  5:00         ` brianh
1998-03-01  5:00           ` Ketil Z Malde
1998-02-26  5:00       ` Doug
1998-02-26  5:00         ` Jeffrey S. Dutky
1998-02-27  5:00   ` Paul Kahler
1998-03-02  5:00     ` Joel Gallun
1998-03-02  5:00       ` Przemek Klosowski
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox