Solution to the naur text-processing problem

Assignment Help C/C++ Programming
Reference no: EM13670847

Design and implement a solution to the Naur text-processing problem using the language specified by your instructor. Execute it against test data and record the number of faults you find and the cause of each fault (e.g., logic fault, loop counter fault). Do not correct any of the faults you detect. So you goal is to just detect the faults, not to correct them.

An important aspect of correctness proofs is that they should be done in conjunction with design and coding. As Dijkstra put it, "The programmer should let the program proof and program grow hand in hand" [Dijkstra, 1972]. For example, when a loop is incorporated into the design, a loop invariant is put forward; and as the design is refined stepwise, so is the invariant. Developing a product in this way gives the programmer confidence that the product is correct and tends to reduce the number of faults. Quoting Dijkstra again, "The only effective way to raise the confidence level of a program significantly is to give a convincing proof of its correctness" [Dijkstra, 1972]. But even if a product is proven to be correct, it must be thoroughly tested as well. To illustrate the necessity for testing in conjunction with correctness proving, consider the following.

In 1969, Naur reported on a technique for constructing and proving a product correct [Naur, 1969]. The technique was illustrated by what Naur termed a line-editing problem; today this would be considered a text-processing problem. It may be stated as follows: Given a text consisting of words separated by blank characters or by newline (new line) characters, convert it to line-by-line form in accordance with the following rules:

1. Line breaks must be made only where the given text contains a blank or newline;

2. Each line is filled as far as possible, as long as

3. No line will contain more than maxpos characters.

Naur constructed a procedure using his technique and informally proved its correctness. The procedure consisted of approximately 25 lines of code. The paper then was reviewed by Leavenworth in Computing Reviews [Leavenworth, 1970]. The reviewer pointed out that, in the output of Naur's procedure, the first word of the first line is preceded by a blank unless the first word is exactly maxpos characters long.

Although this may seem a trivial fault, it is a fault that surely would have been detected had the procedure been tested, that is, executed with test data rather than only proven correct. But worse was to come. London [1971] detected three additional faults in Naur's procedure. One is that the procedure does not terminate unless a word longer than maxpos characters is encountered. Again, this fault is likely to have been detected if the procedure had been tested. London then presented a corrected version of the procedure and proved formally that the resulting procedure was correct; recall that Naur had used only informal proof techniques.

The next episode in this saga is that Good enough and Gerhart [1975] found three faults that London had not detected, despite his formal "proof." These included the fact that the last word is not output unless it is followed by a blank or newline. Yet again, a reasonable choice of test data would have detected this fault without much difficulty. In fact, of the total of seven faults collectively detected by Leavenworth, London, and Good enough and Gerhart, four could have been detected simply by running the procedure on test data, such as the illustrations given in Naur's original paper. The lesson from this saga is clear. Even if a product has been proven correct, it still must be tested thoroughly.

Reference no: EM13670847

Questions Cloud

Determine what total force is exerted on the object : A small object with mass 5.00 kilogram moves counterclockwise with constant speed 5.50 m/s in a circle of radius 3.00 meter centered at the origin. Determine what total force is exerted on the object
Find what the speed of the ball as it strikes the ground : A 0.17 kilogram baseball is launched from the roof of a building15 meter above the ground. Find the speed of the ball as it strikes the ground
Find what is the output voltage of the array : A modded Prius electric car is powered by sixty lithium-iron-phosphate batteries. At a freeway speed of 108 km/h, the average frictional force on the vehicle is only 200 Newton. find what is the output voltage of the array
Draw a venn diagram : Draw a Venn diagram. If a person is chosen at random from the group, what is the probability that the person does not own a microwave, a computer or a DVD player?
Solution to the naur text-processing problem : Design and implement a solution to the Naur text-processing problem using the language specified by your instructor. Execute it against test data and record the number of faults you find and the cause of each fault
Compute what the magnitude of the force : A force in the +y direction applied at the point x=2.3 meter, y=1.4 meter gives rise to a torque of 66 N•m about the origin. Estimate what the magnitude of the force
Obtain the change in speed of the object : A constant force of magnitude of 8.0 Newton is exerted for 4.0 s on a 16 kilogram object initially at rest. Obtain the change in speed of the object
Determine the acceleration of the automobile : A 9000 Newton automobile is pushed along a level road by four students who apply a total forward force of magnitude 500 Newton. determine the acceleration of the automobile
Evaluate what is the new angular speed of the sphere : A 1.4 kilogram 15 centimeter diameter solid sphere is rotating about its diameter at 70 rev/min. If an additional 5.0 mJ of energy are added to the kinetic energy, evaluate what is the new angular speed of the sphere

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Three or more dimensions

What kind of program, or problem, might necessitate arrays of three or more dimensions?

  Implement the graphics portion of the assignment

Analyze a basic set of requirements for a problem - Compose basic C++ language programs

  File containing a series of integers is named

Assume that a file containing a series of integers is named numbers.dat and exists on the computer's disk. Design a java program that reads all the numbers stored in the file and calculates and displays on the console

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Write a program to hold an array of 20 numbers read

Write a program to hold an array of 20 numbers read in from the keyboard and display them backwards. Use a array and a loop to cycle through the numbers.

  Modify the payroll program

Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked.

  Add a copy constructor

Take the code below and add a copy constructor, assignment operator definition and destructor to the class. These functions have already been started for you.

  Illustrate example from ansi c programming language

Illustrate example from ANSI C programming language, without using nested procedures, to show the fact that "assignment-by-sharing in conjunction with quasi-dynamic object binding

  Suggest an application system

Prompt for user login to begin using the system, provide an avenue for users to enter test data - Suggest an application system which is able to perform some arithmetic computations, like commission system, encryption system, timer system, etc, fro..

  You are to create a program

You are to create a program that will input a group of floating point values, storing them as double values in an array. This array will then be sent to three functions.

  To overload a member function of the base class

To overload a member function of the base class A: the name of the function and the formal parameter list of the corresponding function in the derived class must be the same. B: the name of the function must be different

  Consider the following schema of an online flight

consider the following schema of an online flight reservation agency.customercid lastname firstname dobflightfid

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd