comp.lang.ada
 help / color / mirror / Atom feed
From: mfb@mbunix.mitre.org (Michael F Brenner)
Subject: Re: assign help!!
Date: 1997/05/06
Date: 1997-05-06T00:00:00+00:00	[thread overview]
Message-ID: <5kn8ko$jcc@top.mitre.org> (raw)
In-Reply-To: 5kjvcv$evt@news.cis.nctu.edu.tw



    > This is very important to me, is any master-hand can help me?
    > If you can help, please email me the above email address, thanks.
    > This is the wrire_page part of the program, I have done so far:

I am a master-hand, and a world-class Ada programmer, however I cannot
help for the following reasons:
   (1) This submission did not include the definitions of the types
       which it references: page_type, text_line, etc.
   (2) This submission did not include the definitions of the objects
       which it uses: page_length, col_num, current_col, col_width,
       buffer, page_num, space, line, etc.
   (3) This submission did not include the definitions of the methods
       which it invokes: ret_line, page, put, new_line, etc.
   (4) The above missing specifications, definitions, and elaborations
       make the program snippet ambiguous and therefore there are more
       than one correct answers to the question.

It would have been fun to help, but without the parts, the whole is missing.
This is very disappointing that the components are missing, because
bemoaning the vagaries and bugs in the text_io design are a necessary
step in the evolution of Ada programmers, many of whom are introduced
to hacking (the next step above software engineering) by these very bugs!

To start with, I advise the following:
   (A) make all of the type names plural English noun phrases, i.e.
       change page_type to pages, text_line to text_lines, 
       natural to columns, natural to rows, etc. (This will make
       better use of the type checking facility, but more diagnostic
       messages will reveal the rest of the bugs, and your program 
       will be more readable AS AN ENGLISH SENTENCE. That way you
       will avoid personal preferences for schemes that
       capitalize anything except the first letter of computer program
       and acroynyms.);

   (B) add the preconditions (e.g. after line 206 add the assertion
       <assert (col_width = 0)> to identify when the program works,
       by giving (preferably) executable conditions which are True
       at THIS point in the code);

   (C) add the postconditions (e.g. after line 209 add the comment
       <-- line (1..k) has been sent to the correct URL> so the
       reader of the code knows what has been accomplished, that is,
       what is True at THIS point in the code;

   (D) add the invariant conditions (e.g. after line 207 add the comment
       <-- There are col_width+1-k characters left of the slice line (1..k)>
       so the reader of the code knows that the loop is progressing
       and will actually terminate, because, for air conditioning
       purposes, the person running this program at the supercomputer
       lab has to be locked into the computer room with the source code
       diskette, and it gets very uncomfortable in their when a loop
       fails to terminate;

   (E) after doing the above, and providing the missing component
       definitions, and fixing the diagnostic messages which arise
       from introducing the assertions, comments, and strong typing,
       then resubmit the question and better advice can then be given
       that is more directly helpful to finding the exact path,
       rather than advice that just bullies the asker into facing the
       correct half of the compass, lost in the wide boulevard of
       errors contained in this programming snippet;

   (F) enjoy the process of creating programs with complex logic, and
       enjoy the process of simplifying that logic using the strong
       typing of Ada and the assertions (preconditions, postconditions,
       and invariant conditions) of the Ada methodology.  




  reply	other threads:[~1997-05-06  0:00 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-05  0:00 assign help!! Ivan Gou
1997-05-06  0:00 ` Michael F Brenner [this message]
1997-05-07  0:00   ` Charles H. Sampson
1997-05-08  0:00     ` Warning: Religious naming convention discussion :-) [was: assign help!!] John G. Volan
1997-05-09  0:00       ` Jay Martin
1997-05-09  0:00         ` Jeff Carter
1997-05-09  0:00           ` John G. Volan
1997-05-10  0:00             ` Aaron Metzger
1997-05-11  0:00               ` Simon Wright
1997-05-11  0:00               ` Robert Dewar
1997-05-11  0:00                 ` Robert A Duff
1997-05-12  0:00                   ` Robert Dewar
1997-05-12  0:00                     ` Robert A Duff
1997-05-12  0:00                       ` Robert Dewar
1997-05-13  0:00                         ` Robert A Duff
1997-05-13  0:00                           ` Kaz Kylheku
1997-05-14  0:00                             ` Kevin Cline
1997-05-14  0:00                               ` Robert Dewar
1997-05-14  0:00                             ` Robert A Duff
1997-05-13  0:00                           ` Robert Dewar
1997-05-14  0:00                             ` Ole-Hjalmar Kristensen FOU.TD/DELAB
1997-05-13  0:00                         ` David L Brown
1997-05-13  0:00                           ` W. Wesley Groleau (Wes)
1997-05-14  0:00                           ` Robert Dewar
1997-05-11  0:00                 ` John G. Volan
1997-05-12  0:00                 ` Kaz Kylheku
1997-05-12  0:00               ` John G. Volan
1997-05-10  0:00             ` Kaz Kylheku
1997-05-10  0:00               ` John G. Volan
1997-05-10  0:00             ` Robert Dewar
1997-05-10  0:00               ` John G. Volan
1997-05-11  0:00                 ` Robert Dewar
1997-05-12  0:00                   ` Robert I. Eachus
1997-05-13  0:00                     ` Robert Dewar
1997-05-16  0:00                       ` Robert I. Eachus
1997-05-17  0:00                         ` Robert Dewar
1997-05-13  0:00                     ` John G. Volan
1997-05-12  0:00                   ` John G. Volan
1997-05-11  0:00               ` Kevin Cline
1997-05-11  0:00                 ` Robert Dewar
1997-05-12  0:00                   ` John G. Volan
1997-05-12  0:00                     ` Robert Dewar
1997-05-16  0:00                 ` Wayne Magor
1997-05-16  0:00                   ` Robert Dewar
1997-05-18  0:00                     ` Nick Roberts
1997-05-20  0:00                     ` naming convention discussion Peter Hermann
1997-05-16  0:00                   ` Warning: Religious naming convention discussion :-) [was: assign help!!] John G. Volan
1997-05-14  0:00               ` Ben Brosgol
1997-05-14  0:00                 ` naming convention: trailing underscore Peter Hermann
1997-05-14  0:00                   ` John G. Volan
1997-05-15  0:00                   ` Michael F Brenner
     [not found]                 ` <dewar.863717431@merv>
1997-05-16  0:00                   ` naming convention discussion Peter Hermann
1997-05-16  0:00                     ` Robert Dewar
1997-05-20  0:00                       ` Peter Hermann
1997-05-16  0:00                   ` Warning: Religious naming convention discussion :-) [was: assign help!!] Robert A Duff
1997-05-18  0:00                     ` Underscores in identifiers (was: Warning: Religious naming convention discussion :-) Ben Brosgol
1997-05-17  0:00                   ` Warning: Religious naming convention discussion :-) [was: assign help!!] Arthur Schwarz
1997-05-17  0:00                     ` Robert Dewar
1997-05-17  0:00                       ` John G. Volan
1997-05-18  0:00                         ` Andrew Dunstan
1997-05-18  0:00                           ` Nick Roberts
1997-05-19  0:00                             ` John G. Volan
1997-05-19  0:00                             ` John G. Volan
1997-05-12  0:00             ` Jeff Carter
1997-05-12  0:00               ` John G. Volan
1997-05-12  0:00             ` W. Wesley Groleau (Wes)
1997-05-12  0:00               ` John G. Volan
1997-05-13  0:00                 ` W. Wesley Groleau (Wes)
1997-05-13  0:00                   ` John G. Volan
1997-05-14  0:00                     ` naming convention discussion Peter Hermann
1997-05-14  0:00                       ` John G. Volan
1997-05-14  0:00                         ` Peter Hermann
1997-05-14  0:00                           ` John G. Volan
1997-05-15  0:00                             ` Peter Hermann
1997-05-15  0:00                           ` W. Wesley Groleau (Wes)
1997-05-14  0:00                     ` Warning: Religious naming convention discussion :-) [was: assign help!!] Do-While Jones
1997-05-14  0:00                       ` John G. Volan
1997-05-14  0:00                         ` John G. Volan
1997-05-15  0:00                         ` Tangent to Religious naming convention discussion W. Wesley Groleau (Wes)
1997-05-15  0:00                           ` John G. Volan
1997-05-14  0:00                       ` Warning: Religious naming convention discussion :-) [was: assign help!!] Stephen Leake
1997-05-09  0:00           ` John G. Volan
1997-05-10  0:00           ` Robert Dewar
1997-05-10  0:00             ` John G. Volan
1997-05-11  0:00               ` Robert Dewar
1997-05-12  0:00                 ` John G. Volan
1997-05-12  0:00               ` W. Wesley Groleau (Wes)
1997-05-12  0:00             ` W. Wesley Groleau (Wes)
1997-05-12  0:00               ` John G. Volan
1997-05-11  0:00           ` Doug Smith
1997-05-12  0:00           ` Tom Moran
1997-05-16  0:00           ` Wayne Magor
1997-05-16  0:00             ` John G. Volan
1997-05-17  0:00             ` Kevin Cline
1997-05-19  0:00               ` Doug Smith
1997-05-09  0:00         ` John G. Volan
1997-05-09  0:00       ` Kevin Cline
1997-05-09  0:00         ` John G. Volan
1997-05-12  0:00       ` W. Wesley Groleau (Wes)
1997-05-12  0:00         ` John G. Volan
1997-05-12  0:00         ` John G. Volan
1997-05-10  0:00     ` assign help!! Simon Wright
1997-05-14  0:00       ` Nick Roberts
replies disabled

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