From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,INVALID_MSGID, PLING_QUERY,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e0afec3ed133afd9 X-Google-Attributes: gid103376,public From: wheeler@ida.org (David Wheeler) Subject: Re: Enumerations and Arrays Unnecessary!??? Date: 1997/06/16 Message-ID: <5o3ppu$rpb@news.ida.org>#1/1 X-Deja-AN: 248859362 References: <33A16AC0.1BA4@calvin.cca.rockwell.com> Organization: IDA, Alexandria, Virginia Reply-To: dwheeler@ida.org Newsgroups: comp.lang.ada Date: 1997-06-16T00:00:00+00:00 List-Id: 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