Article View: comp.lang.misc
Article #5735Object Oriented vs. Overloaded
From: ~XT4103000~Marc Mengel~C25~G25~6...
Date: Mon, 12 Sep 1988 19:29
Date: Mon, 12 Sep 1988 19:29
48 lines
2647 bytes
2647 bytes
In article <2854@utah-gr.UUCP> u-jleigh%sundial.utah.edu.UUCP@utah-gr.UUCP (Jason Leigh) writes:
>I do not agree with your notion that using a '+' to concat two strings
>causes 'sloppy' code. Such an allowance is called 'overloading' which
>is a concept availabe on most modern object oriented programming languages
>such as Ada and C++. The purpose of overloading is to enhance the
>readability of code by hiding as much unnecessary information as possible.
>I am surprised that after having written an Ada compiler, you never came
>across overloading...
Overloading is NOT equivalent to object oriented programming. Object oriented
programming is a paradigm which *can* be used in *most* programming languages.
(a variation on "Real programmers can write FORTRAN in any language...")
Overloading when taken to the extreme creates a program that the author
can read, but nobody else can. If you have to walk in cold and read
mytype a,b,c;
foo()
{
a = a + b;
a++;
c = c - a;
}
and guess that a, b, and c are vectors of linked lists, and "+" involves
an O(n**2) combinatorial mixture of the two operands; the code is not
clear. (sure you can document it with comments, etc. but the problem
is that you can also *not* document it...). It is even more confusing
if the "-" operation is unrelated to the "+" operation, etc. It may make
perfect sense to the author, but some poor sod who gets hired to maintain
the code 5 years later when a bug is discovered has to learn someone else's
notation in order to make sense of the code.
Smalltalk is the only language I know of that *forces* you to operate within
the Object Oriented paradigm. C++ allows some syntactic sugar on the front
of C, but not much else (There are many who disagree on this point -- flames
to me, not the net). Ada doesn't really provide any concept of classes,
sub-classes or inheritance, so it doesn't have many built-in's for Object
Oriented programming, although you can construct such a system.
>Jason Leigh
--
Marc Mengel
mmengel@cuuxb.att.com
attmail!mmengel
{lll-crg|mtune|att}!cuuxb!mmengel
Technical Details
Message-ID:
<2058@cuuxb.ATT.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!mordor!joyce!ames!nrl-cmf!ukma!rutgers!att!cuuxb!mmengelShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!mordor!joyce!ames!nrl-cmf!ukma!rutgers!att!cuuxb!mmengel From: mmengel@cuuxb.ATT.COM (~XT4103000~Marc Mengel~C25~G25~6184~) Newsgroups: comp.lang.misc Subject: Object Oriented vs. Overloaded Keywords: sloppy code, overload, object oriented, ada, c++, smalltalk Message-ID: <2058@cuuxb.ATT.COM> Date: 12 Sep 88 19:29:15 GMT Reply-To: mmengel@cuuxb.UUCP (Marc W. Mengel) Organization: AT&T, Data Systems Division, Lisle, IL Lines: 47