comp.lang.ada
 help / color / mirror / Atom feed
From: Joseph P Vlietstra <joevl@concentric.net>
Subject: Re: Answering an Ada/COBOL Question
Date: 1999/11/15
Date: 1999-11-15T00:00:00+00:00	[thread overview]
Message-ID: <382FA652.A72E4150@concentric.net> (raw)
In-Reply-To: 80hr16$5q2$1@nntp5.atl.mindspring.net

Richard D Riehle wrote:

> I once challenged some Ada programmers to come up with an Ada design
> that would be as expressive as the Evaluate statement.  None of the
> solutions was satisfactory.  If you think you have a solution that is
> as expressive as that in COBOL, be sure you cover all the variations
> possible, not simply the one I just demonstrated.

Back in the good old days when Fortran was FORTRAN, we designed a sonar
simulator strictly using decision tables.  While we couldn't directly express
the
decision table in FORTRAN, we could incorporate the decision table in
comments.
(In fact, this was required item that was checked in the peer reviews.)
Using comments to document the decision table works in any language!

We no longer try to use decision tables for everything.  But when decision
tables
are used for design, we still follow these rules:
-- decision table is in canonical format ("major" decisions first)
-- decision table appears in comments above implementing code
-- predicates are evaluated in same order as they appear in decision table

In my experience, many decision tables contain "don't care" entries.
For example, if Marital_Status = Single then Age_Of_Spouse is a don't care.
When a decision table is ordered correctly (don't cares entries in upper
right)
the implementation drops out.  (See "Decision Tables in Software Engineering"

or CODASYL publication on decision tables -- I'm at home so I can't grab the
exact title from the bookshelf.)

For example, the following decision table:
        A    B    C
        T    X    X    Action_1
        F    T    X    Action_2
        F    F    T    Action_3
        F    F    F    Action_4
can be implemented as:
        if A then
            Action_1;
        elsif B then
             Action_2;
        elsif C then
            Action_3;
        else
            Action_4;
        end if;
Yes, this example is extreme, but I rarely see a decision table design that
doesn't
have some don't care entries.

Also, in my obsolete COBOL experience, I never implemented an Evaluate
statement to test several conditions.  It always seemed cleaner to break the
logic into nested If and Evaluate statements.






  parent reply	other threads:[~1999-11-15  0:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-12  0:00 Answering an Ada/COBOL Question Richard D Riehle
1999-11-13  0:00 ` Brian Rogoff
1999-11-14  0:00   ` Robert Dewar
1999-11-13  0:00     ` Brian Rogoff
1999-11-14  0:00       ` Robert Dewar
1999-11-14  0:00         ` Brian Rogoff
1999-11-15  0:00           ` Richard D Riehle
1999-11-15  0:00             ` Brian Rogoff
1999-11-16  0:00               ` Robert Dewar
1999-11-16  0:00               ` Erlang (Was Re: Answering an Ada/COBOL Question) Vladimir Olensky
1999-11-16  0:00                 ` Vladimir Olensky
1999-11-17  0:00                   ` Samuel Tardieu
1999-11-19  0:00                     ` Robert Dewar
1999-11-22  0:00                       ` Samuel Tardieu
1999-11-22  0:00                         ` Brian Rogoff
1999-11-17  0:00                 ` Samuel Tardieu
1999-11-18  0:00                   ` Robert Dewar
1999-11-19  0:00                     ` Vladimir Olensky
1999-11-19  0:00                   ` Vladimir Olensky
1999-11-16  0:00             ` Answering an Ada/COBOL Question Robert Dewar
1999-11-16  0:00               ` Richard D Riehle
1999-11-18  0:00                 ` Robert Dewar
1999-11-18  0:00                   ` tmoran
1999-11-19  0:00                     ` Robert I. Eachus
1999-11-18  0:00                   ` Marin Condic
1999-11-19  0:00                     ` Robert Dewar
1999-11-19  0:00                       ` Marin Condic
1999-11-19  0:00                         ` Robert Dewar
1999-11-15  0:00 ` Joseph P Vlietstra [this message]
1999-11-15  0:00   ` Robert Dewar
replies disabled

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