TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Mike F. Brenner" <[log in to unmask]>
Reply To:
Mike F. Brenner
Tue, 6 May 1997 14:34:49 -0400
text/plain (41 lines)
Yes, Alexandre, it is possible to initialize a multi-dimensional array during
its elaboration. For a two dimensional array, here is an example:

  type people is (Mike, Alexandre);
  type classes is (meditation, ego_control, self_possession);
  type months is (December, January);
  type years is range 97..99;
  type days is range 1..30;
  type dates is record
     month: months;
     day: days;
     year: years: natural;
  end record;
  type training_charts is array (people, classes) of dates;
  training_chart: training_charts :=
      (people => (classes => (January, 1, 98)));

Here, the training chart is a two-dimensional array of people taking
classes. The chart gives the date that person is scheduled to take
that class. The chart uses the usual convention that dates use
two-digit years, with 99 being the code for an error, and 98 being
the code meaining NO_SCHEDULED_DATE, like in many command and control
messages. Unlike most command and control messages, there is an
unusual definition for days permitting only the dates from 1 through
30, instead of the usual 1 through 31. The reason for this is that
the developer knew that they were not going to get the maintenance
contract, and the test the user agreed upon did not test any particular
date on the 31st of any month, so there was no need to make it work
for the 31st. This is common practice in the industry, not only to
have a separate maintainer, but also a separate manager of software
maintenance from development. The real question is, how will the
maintainer fix the 31st problem, given that it is now already
December of 1997? What additional bugs will the maintainers insert
into the code? Or will those pesky maintainers change the data format
to use a gottloser, verdammter 4-digit year? If they do, which other
modules in the system will this impact? Let us quickly resolve to keep
our two-digit date format, before it is too late and everybody starts
transmitting 4-digit dates! Put it in the company development standard
that all dates have 2-digit years (and sik quality assurance on anyone
who dares to widen the date fields :)