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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b0d68c502c0ae6 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Printing Enum Variable Re: Linux World Date: 1999/03/05 Message-ID: <7bpevu$frn@dfw-ixnews12.ix.netcom.com>#1/1 X-Deja-AN: 451681214 References: <7bfc2n$jl9@dfw-ixnews5.ix.netcom.com> <7bhh26$r7c$1@remarQ.com> <36DCAC1F.430E2C5E@aasaa.ofe.org> <7bk4v8$kl8$1@remarQ.com> <36DDA761.7B4E8099@aasaa.ofe.org> <7bkrmm$ao1$1@nnrp1.dejanews.com> Organization: Netcom X-NETCOM-Date: Fri Mar 05 2:31:58 PM CST 1999 Newsgroups: comp.lang.ada Date: 1999-03-05T14:31:58-06:00 List-Id: In article , Ehud Lamm wrote: in reference to Ada enumeration types, >Time and again I am amazed how this simple festure ofthe language stumps >people. I see exercises which show understanding of important and >difficult concepts like genericity - but fail to exploit enumeration type >where appropriate. This should really end up on my idiom list. Enumeration types also carry the potential for abuse. I recall a programmer who had a package specification with an enumeration type where the set of values spanned three pages of source code. If enumeration types are to be on the idiom list, they should be accompanied by a set of guidelines. One of the problems we are trying to solve with object-oriented programming and child library units is the extension of existing code without performing "open heart surgery" on it. Heavy use of enumeration types can result in cracking open existing code to perform such extensions. Some of the guidelines I follow, and counsel my clients to follow, 1) only use enumeration types when there is a well-known limit to the set of values. 2) Use them when there is a clear requirement for an ordered set, 3) Use them for identifying types that have a small set of values (e.g., Location is (Front, Back);). There is a point of view in the OOP community that says that enumeration types are an artifact of an obsolete style of programming. That is, an enumeration type, because it is not extensible and cannot be further specialized, is antithetical to OOP. Although I find this viewpoint a little too narrow for my taste, one could make a very good case to support it in many situations. Richard Riehle richard@adaworks.com http://www.adaworks.com