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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ec7fc30600a974ce X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: Programming for the World in Ada95 Date: 2000/02/16 Message-ID: <38aaf154@eeyore.callnetuk.com>#1/1 X-Deja-AN: 586624526 References: <38A83838.44A43A7D@res.raytheon.com> <88b4oa$ljt$1@wanadoo.fr> <38A99E37.F355452C@quadruscorp.com> X-Original-NNTP-Posting-Host: da129d182.dialup.callnetuk.com X-Trace: 16 Feb 2000 18:49:56 GMT, da129d182.dialup.callnetuk.com X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Date: 2000-02-16T00:00:00+00:00 List-Id: I was going to write an extensive reply to this one, but (I hear you sigh with relief ;-) I've cut it down to the following brief recommendations. 1. Introduce one package which declares an abstract root tagged type to represent a piece of text, and a function to turn the object into actual (Unicode) text. E.g.: package International.Text is type Root_Text_Piece is abstract tagged private; function Image (Piece: in Root_Text_Piece) return Wide_String is abstract; end; 2. Derive types (in child or other packages, as appropriate) which correspond to actual text messages. You must implement the 'Image' function for each. Use an enumerated type as the basic message selector, and have a derived type (its extension part) contain a component of this enumerated type. The type can be further parametised in the same way, as necessary. You can often avoid having to parameterise things too much by recasting your output in a form which moves the parametised bits (e.g. numbers) out from being embedded in the text. For example, instead of saying "there were 16 errors, of which 9 matter", you could say "Total number of errors: 16" on one line, and "Number of critical errors: 9" on the next line, perhaps. This style often tends to be neater, easier to read, easier to program, easier to maintain and change, and generally avoids the necessity for messing around with singular and plural forms. 3. Introduce a package (maybe generic) which implements message retrieval from a configuration file or (much better) a database table. If your project is divided into separate modules, being developed independently to some extent (or simply if the program is very large), make sure you have facilities for each module's person/team to add and delete messages to/from the file/table independently of one another. Add a package that allows you to list the enumeration literals that are message selectors against their corresponding file/table messages (and keys). Maybe add 'fallback' code that uses an internal message table in the event the configuration file/table cannot be opened. -- Nick Roberts http://www.adapower.com/lab/adaos