19A. Localization and Successive Refinement


What is successive refinement?

Successive refinement is a process for implementing a piece of software that greatly simplifies error localization.

If you try to write an entire piece of software before testing, then you will have a lot of mistakes, and you will have no idea where to look to localize each mistake. With a lot of mistakes, it is difficult even to extract a single mistake to work on.

Develop a refinement plan that breaks the implementation process into milestones, or stages. For example, if one job that your program needs to do is to read in some data from a file, then a simple milestone is a program that just reads the data and shows what it read.

Test the software after each stage. If there is a mistake, it is usually in the small part that you have just written. Most of the time, localizing a mistake becomes easy. Of course, this only works if you test after each stage and you fix any mistakes that you found before moving on to the next stage.


Refinement barriers

Learning successive refinement is part of this course, and I am required to ensure that you learn things that are part of the course. Therefore, I must do something to ensure that students use successive refinement.

Each assignment has a refinement plan already prepared for you. You must follow it. Each step in the refinement plan is a refinement barrier, meaning the following.

If
  • the implementation of a particular stage A is always or almost always wrong and

  • stage B is later in the refinement plan than stage A and

  • stage B depends on stage A

then
  • any part of your code that is concerned solely with stage B does not count toward your grade. Your grade will be the same as if you had not written the code for part B.

For example, suppose the program needs to read some data. If the code to read the data is so wrong that it is unusable, then code for later stages that depend on the data will not count. That gives you strong motivation to ensure that each stage is correct before moving on to the next stage.


Exercises

  1. What is successive refinement? Answer

  2. What is the refinement barrier rule for this course? Answer