Article View: comp.lang.misc
Article #6507Re: OOP features in Turbo Pascal 5.5
From: Alastair Milne
Date: Fri, 26 May 1989 02:01
Date: Fri, 26 May 1989 02:01
75 lines
4956 bytes
4956 bytes
rogerson@PEDEV.Columbia.NCR.COM (Dale Rogerson) writes
>> As in [various Pascal's, modula-2] the unit construct
>> ... object >> orientation -- though I would probably continue
>> to prefer the term "abstract data types",
>> Alastair Milne
>The main problem with the Unit construct in the Turbo 4 is the lack of hidden
>data, and generics. These two features, found in Modula 2, allow the creation
>of better abstact data types.
You are, of course, correct about the missing abilities in units. This is
probably because Turbo borrowed units, either directly or indirectly, from
UCSD Pascal, which installed them almost 10 years ago, and none of their
inheritors (that is to say, none of the derivative Pascal dialects of
which I'm aware) has looked at any serious extension of them. In fact,
they're stilling trying to do as much as UCSD units did. So the
limitations that were (and are) in UCSD units are to be expected in
MicroSoft and Borland units.
However, unless Wirth has recently updated Modula-2, it does not have
generics, and its concealment of data construction is half accidental:
when you declare a type as a POINTER TO something else, the something else
doesn't have to be listed in the description module (forgot the right
name, sorry); however, if some external user takes a stab at a component
-- or even correctly names it by accident -- Modula-2 syntax makes it
available and manipulable.
At the risk of being obvious, are you perhaps thinking of Ada, which has
the features you name, and addresses explicitly the problem you mention?
>In TP if you want someone to use a data type
>... then [it] type must be fully discribe in the interface ... This has
> the potential for abuse. If someone knows the implementation ...
>, the may start coding in a way that will abuse the OOPs design.
Very true. On our project, we've lived with this for years: our major
screen support and general factotum unit is obliged to export some large
and detailed types whose details we don't actually want any program to
know -- if they start depending on those details, we're in a tough
situation come the next round of support upgrades. But the best we can do
is say in our manuals *HANDS OFF*, in the most convincing terms possible.
BTW, that phrase "general factotum" may sound as if we've chucked the
kitchen sink into a single unit, and I'm afraid in a way we have. This
was done because at the time the operating system only allowed 7 units
for one program, and we were pushing it, so things went together into
the same unit which really should have been kept separate. Having lived
with the consequences for a number of years now has made me an ardent
supporter of true modularity.
>Generics are even better, they make programming funner :-). With generics
>you can create link lists, stack, and other such structures without having to
>worry about what kind of data is in the linked list or the stack.
"Funner?" Yes, I think they do. (Though why Ada makes this the only way
of passing procedural parameters has never been clear to me.)
There is no question that Ada provides superior data abstraction
capabilities to any Pascal that I know of, which implies better service to
your client modules, and better reliability. What it costs you, though,
is something else again. There may be some argument that Modula-2's
half-hidden types and much reduced size are perhaps preferable to
Ada's powerful export capacities but very considerable size.
Boy is this off the topic.
My final thought: if you know how to implement object-handling, units
(whether UCSD, TP4, TP5) should provide a good platform for building it,
provided you're prepared to handle the lack of privacy and the potential
for abuse by users' being able to manipulate features that are intended
for the unit's use alone. On the other hand, why not wait for Turbo 5.5
and see what having built-in object orientation can do for you? (Assuming
of course that other aspects of the new version are acceptable too).
Alastair Milne
Technical Details
Message-ID:
<15821@paris.ics.uci.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!rutgers!apple!ames!elroy!usc!orion.cf.uci.edu!uci-ics!milneReferences:
<846@wucs1.wustl.edu> <15150@paris.ics.uci.edu> <2537@PEDEV.Columbia.NCR.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!rutgers!apple!ames!elroy!usc!orion.cf.uci.edu!uci-ics!milne From: milne@ics.uci.edu (Alastair Milne) Newsgroups: comp.lang.misc,comp.lang.pascal Subject: Re: OOP features in Turbo Pascal 5.5 Keywords: ada modula-2 units object OOPS abstract TP4 TP5 UCSD Message-ID: <15821@paris.ics.uci.edu> Date: 26 May 89 02:01:12 GMT References: <846@wucs1.wustl.edu> <15150@paris.ics.uci.edu> <2537@PEDEV.Columbia.NCR.COM> Sender: news@paris.ics.uci.edu Reply-To: Alastair Milne <milne@ics.uci.edu> Distribution: na Organization: Educational Technology Center, Dept. of ICS, UC Irvine Lines: 75