comp.lang.ada
 help / color / mirror / Atom feed
From: "Michael Young" <nobody@all.org>
Subject: Re: Printing Enum Variable Re: Linux World
Date: 1999/03/09
Date: 1999-03-09T00:00:00+00:00	[thread overview]
Message-ID: <7c4ru6$e45$1@remarQ.com> (raw)
In-Reply-To: 1999Mar9.131659.1@eisner

Larry Kilgallen <kilgallen@eisner.decus.org> wrote in message
news:1999Mar9.131659.1@eisner...

> The role of the language is that those concerns permeate the design
> of the language.  For instance, the enumerated types discussed earlier
> allow me to create a variable of type Traffic_Light_Color, knowing that
> the only values that can be assigned to it are Red, Yellow and Green.
> Furthermore, I know it cannot mistakenly get intermixed with values
> for a coworker's type Political_Orientation which has values Red
> and Freedom_Loving_Capitalist.

I view these as design issues, not really coding problems. Who wants to know
what color the traffic light is, and why? My first guess is that a state
machine is a more appropriate abstraction. Likewise for your co-workers'
political views: these might be better captured as polymorphic behaviors. With
that said, there is no getting around the neutral nature of storage media.
From now until some enlightened future, these attributes will likely be stored
as coded numeric values in databases. This will always be a weak link, since
somebody outside the development staff can change the coding to your
detriment. I can do no more than check for a valid range -- isolated in the
factory implementation -- which need not be hard-coded as a distinct type. Ada
has the minor advantage of not having to manually check for the expected
range.

> That general idea is available in Pascal and other languages, but
> Ada takes it a bit further and allows me to iterate from the start
> (Traffic_Light_Color'first) to the end (Traffic_Light_Color'last)
> without specifically naming the values and thus making me immune

See above. Maybe for a lack of iteration, I don't find a need for iteration. I
find types with behaviors to be more appropriate than enumerations in more
cases than not.

> In general, Ada tends toward compilation errors for those who have not
> understood the rules.  That includes experts who have temporarily forgot
> while working on something Important, as well as students whose first
> reaction is to try it themselves rather than asking for their homework
> answers on comp.lang.ada. :-)

Aye. Compared to the untrained Java multitudes, C++ benefits from requiring
more upfront knowledge and experience. Ada tops even C++ in this regard. As an
pre-employment filter, this is not altogether a bad thing.

Michael.






  reply	other threads:[~1999-03-09  0:00 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-02  0:00 Linux World Richard D Riehle
1999-03-02  0:00 ` fraser
1999-03-02  0:00   ` Printing Enum Variable " David Starner
1999-03-03  0:00     ` Larry Kilgallen
1999-03-03  0:00       ` Nick Roberts
1999-03-03  0:00         ` David Starner
1999-03-03  0:00     ` Fraser Wilson
1999-03-03  0:00       ` David Starner
1999-03-04  0:00         ` Richard D Riehle
1999-03-04  0:00         ` robert_dewar
1999-03-04  0:00         ` Magnus Larsson
1999-03-03  0:00           ` Hans Marqvardsen
1999-03-04  0:00             ` robert_dewar
1999-03-04  0:00               ` Hans Marqvardsen
1999-03-05  0:00                 ` dewar
1999-03-07  0:00                   ` Hans Marqvardsen
1999-03-04  0:00               ` Hans Marqvardsen
1999-03-05  0:00                 ` dewar
1999-03-05  0:00                   ` David Botton
1999-03-05  0:00                     ` robert_dewar
1999-03-05  0:00                 ` Larry Kilgallen
1999-03-04  0:00             ` Nick Roberts
1999-03-03  0:00           ` Printing Enum Variable Re: Linux World (Correction) Hans Marqvardsen
1999-03-04  0:00         ` Printing Enum Variable Re: Linux World fraser
1999-03-05  0:00           ` Nick Roberts
1999-03-05  0:00             ` fraser
1999-03-04  0:00         ` Richard D Riehle
1999-03-03  0:00     ` fraser
1999-03-03  0:00       ` David Starner
1999-03-03  0:00         ` Samuel T. Harris
1999-03-03  0:00         ` fraser
1999-03-04  0:00         ` dennison
1999-03-04  0:00           ` Ehud Lamm
1999-03-04  0:00         ` robert_dewar
1999-03-03  0:00           ` David Starner
1999-03-04  0:00             ` robert_dewar
1999-03-04  0:00             ` Samuel Mize
1999-03-04  0:00               ` Samuel Mize
1999-03-05  0:00                 ` Robert A Duff
1999-03-05  0:00               ` Robert A Duff
1999-03-07  0:00               ` Florian Weimer
1999-03-07  0:00                 ` Michael Young
1999-03-07  0:00                   ` Matthew Heaney
1999-03-08  0:00                     ` Michael Young
1999-03-08  0:00                       ` Matthew Heaney
1999-03-07  0:00                   ` Larry Kilgallen
1999-03-07  0:00                     ` Michael Young
1999-03-08  0:00                       ` robert_dewar
1999-03-08  0:00                         ` Richard D Riehle
1999-03-09  0:00                           ` Michael Young
1999-03-09  0:00                             ` Larry Kilgallen
1999-03-09  0:00                               ` Michael Young [this message]
1999-03-10  0:00                                 ` Mike Silva
1999-03-09  0:00                               ` billy
1999-03-10  0:00                                 ` robert_dewar
1999-03-10  0:00                                   ` Dale Stanbrough
1999-03-10  0:00                                     ` dennison
1999-03-10  0:00                                       ` bob
1999-03-10  0:00                                         ` Mike Silva
1999-03-10  0:00                                           ` dennison
1999-03-10  0:00                                           ` Nick Roberts
1999-03-10  0:00                                     ` Pascal Obry
1999-03-10  0:00                                     ` Richard D Riehle
1999-03-10  0:00                                 ` Pascal Obry
     [not found]                               ` <7c4ru6$e45$1@remarq.com>
1999-03-10  0:00                                 ` fraser
     [not found]                               ` <7 <7c58qa$b6b$1@cf01.edf.fr>
1999-03-10  0:00                                 ` fraser
     [not found]                             ` <1999Mar9.131659. <dale-1003991644340001@r1021c-07.ppp.cs.rmit.edu.au>
1999-03-10  0:00                               ` Larry Kilgallen
1999-03-08  0:00                       ` Florian Weimer
1999-03-08  0:00                       ` Larry Kilgallen
1999-03-08  0:00                         ` robert_dewar
1999-03-04  0:00           ` Ehud Lamm
1999-03-05  0:00             ` Richard D Riehle
1999-03-05  0:00               ` Nick Roberts
1999-03-06  0:00                 ` Ehud Lamm
1999-03-06  0:00                   ` robert_dewar
1999-03-06  0:00                     ` Larry Kilgallen
1999-03-06  0:00                       ` Dave Taylor
1999-03-06  0:00                         ` Bruce or Tracy
1999-03-06  0:00                     ` Ehud Lamm
replies disabled

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