1. Stepwise refinement techniques involve incrementally refining an informal algorithm into a formal algorithm through multiple stages of formalization until a program is developed.
2. There are three stages: modeling to represent the problem mathematically, writing a pseudo-code algorithm, and choosing implementations for data types to write the program.
3. Programming involves five phases - requirements, design, analysis, coding, and verification through testing, debugging, and proving the program is correct.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
729 views
Stepwise Refinement Techniques
1. Stepwise refinement techniques involve incrementally refining an informal algorithm into a formal algorithm through multiple stages of formalization until a program is developed.
2. There are three stages: modeling to represent the problem mathematically, writing a pseudo-code algorithm, and choosing implementations for data types to write the program.
3. Programming involves five phases - requirements, design, analysis, coding, and verification through testing, debugging, and proving the program is correct.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10
Stepwise Refinement Techniques
• An appropriate mathematical model is required to
write an algorithm for a problem. • The initial version of the algorithm will contain general statements, i.e., informal instructions. • Convert this informal algorithm to formal algorithm, that is, more definite instructions by applying any programming language syntax and semantics partially. • Finally a program can be developed by converting the formal algorithm by a programming language manual. Contd., • There are several steps to reach a program from a mathematical model. • In every step there is a refinement (or conversion). • That is to convert an informal algorithm to a program, several stages of formalization is required to formally define the algorithm by a programming language manual — is called stepwise refinement techniques. • There are three steps in refinement process Contd., 1. In the first stage, modelling, try to represent the problem using an appropriate mathematical model such as a graph, tree etc. At this stage, the solution to the problem is an algorithm expressed very informally. 2. At the next stage, the algorithm is written in pseudo-language (or formal algorithm) that is, mixture of any programming language constructs and less formal English statements. The operations to be performed on the various types of data become fixed. 3. In the final stage we choose an implementation for each abstract data type and write the procedures for the various operations on that type. The remaining informal statements in the pseudo-language algorithm are replaced by (or any programming language) C/C++ code Phases of Programming • There are five phases in programming • Requirements • Design • Analysis • Coding and • Verification Contd., • Requirements - understand the information you are given (the input) and what results you are to produce (the output). • Design – Several Objects, for each object there will be some basic operations to perform on it. These operations already exist in the form of procedures and write an algorithm which solves the problem according to the requirements. Contd., • Analysis – Choose the more desirable algorithm than the other • Refinement and Coding – write algorithms for each of the operations on these objects. – Good design should changes relatively easily. – Debugging on by doing a new version Contd., • Verification – consists of three distinct aspects: program proving, testing and debugging. 1. Program Proving – prove the program is correct before executing your program for all possible combinations of inputs, the program and its specification agree. Contd., 2. Testing and Debugging – Testing is the art of creating sample data upon which to run your program. – If the program fails to respond correctly then debugging is needed to determine what went wrong and how to correct it. – process errors are discovered in the code. – Prove program methodology by discovering errors. – Tools available to aid in the testing process. Contd., – One such tool instruments your source code and then tells you for every data set: (i) The number of times a statement was executed, (ii) The number of times a branch was taken, (iii) the smallest and largest values of all variables. • The test data you construct should force every statement to execute and every condition to assume the value true and false at least once. • Larger the software, the more crucial is the need for documentation.