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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2078dddcdcd8d83 X-Google-Attributes: gid103376,public From: mfb@mbunix.mitre.org (Michael F Brenner) Subject: Re: assign help!! Date: 1997/05/06 Message-ID: <5kn8ko$jcc@top.mitre.org>#1/1 X-Deja-AN: 239725437 References: <5kjvcv$evt@news.cis.nctu.edu.tw> Organization: The MITRE Corporation, Bedford Mass. Newsgroups: comp.lang.ada Summary: insufficient information Date: 1997-05-06T00:00:00+00:00 List-Id: > 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 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.