comp.lang.ada
 help / color / mirror / Atom feed
From: wheeler@ida.org (David Wheeler)
Subject: Re: Enumerations and Arrays Unnecessary!???
Date: 1997/06/16
Date: 1997-06-16T00:00:00+00:00	[thread overview]
Message-ID: <5o3ppu$rpb@news.ida.org> (raw)
In-Reply-To: 33A16AC0.1BA4@calvin.cca.rockwell.com


Just a few random comments...

JR Crosmer (jrc@calvin.cca.rockwell.com) wrote:
: In the past six months I have a course in object oriented design and
: another one in object oreinted design (5-days each) .  In each course
: the instructor insisted rather stronly that "There is no need for
: enumeration types or array types."  Neither instructor had any
: familiarity with Ada83 or Ada95.  They each suggested that an
: enumeration litteral be thought of as an object: e.g., send a message to
: the color Red to do something.  Thay also insisted that in any
: situations in which an array is used, the implementation is not a good
: fit to the underlying problem.

: In my experience, I would be very hard pressed to give up either 
: enumerations or arrays, especially with the capabilities allowed
: and enhanced with Ada attributes and data typing rules.

Both arrays and enumerations are useful abstractions.
There's nothing wrong with thinking of an enumeration literal
as an object that receives messages, if that helps.

: In contrast, in C, C++ or Java, enumerations have almost no capability
: since they are treated mostly as named integers w/respect to name space
: and type compatibility.

You'd be hard-pressed to use enumerations in Java... Java doesn't
have the ability to define a new enumeration type.
This is one the weaknesses, not strengths, of
the Java language.  Java programs simulate enumerations by using
constants of various integer types, which unfortunately weakens
its ability to define interfaces well and eliminates a useful form of
error-checking.

It _is_ true that arrays are sometimes used when a better abstraction
should be used instead; some languages only support arrays and people
who only know such languages have trouble using richer capabilities.
Still, many mathematical routines would be hard to understand without arrays.

In summary: use the tool that's best for your problem.


--- David A. Wheeler
    dwheeler@ida.org





      parent reply	other threads:[~1997-06-16  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-13  0:00 Enumerations and Arrays Unnecessary!??? JR Crosmer
1997-06-14  0:00 ` Robert Dewar
1997-06-16  0:00   ` Fanaticism [was Re: Enumerations and Arrays Unnecessary!???] Jan Galkowski
1997-06-14  0:00 ` Enumerations and Arrays Unnecessary!??? Robert A Duff
1997-06-14  0:00   ` Robert Dewar
1997-06-18  0:00     ` Nick Roberts
1997-06-18  0:00       ` Robert A Duff
1997-06-16  0:00 ` David Wheeler [this message]
replies disabled

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