Steps for Developing a 'C' program


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Steps for Developing a 'C' program

  2. 2. INTRODUCTION • 1) 2) 3) • The program development process in C includes three important stages namely: Program design Program coding and Program testing All the three stages contribute to production of high quality programs
  3. 3. 1) Program design : • It is a foundation for good program. • Program design basically concerned with development strategy to be used in writing program, in order to achieve solution of a problem. • This includes mapping out a solution procedure and the form the program would take.
  4. 4. • Program design involves 4 stages namely: i) Problem analysis ii) Outlining the program structure iii) Algorithm development iv) Selection of control structure • Problem analysis: Before we think a solution procedure to a problem, we must fully understand the nature of the problem and what we want the program to do.
  5. 5. • Outlining the program structure : Once we have decided what we want and what we have, the next step is to decide how to do it. • As a structured language C lends itself to top-down approach. • Top-down approach means decomposing of solution procedure into tasks that form a hierarchical structure. • The essence of top-down approach is to cut the whole program into number of independent constitutent tasks and then cut into smaller subtasks
  6. 6. • This approach will produce a readable and modular code that can be easily understood and maintained. • It also helps us classify overall functioning of a program in terms of lower- level functions. iii) Algorithm Development: Step by step procedure for each function is known as algorithm. • The most common method of describing an algorithm is through the use of flow charts. • The other method is pseudo code.
  7. 7. • flow chart represents algorithm pictorially, while pseudo code describe the solution steps in logical order. iv) Control structures: Any algorithm can be structured using three basic control structure namely: a) sequence structure b) selection structure c) looping structure a) Sequence structure: sequence structure denotes the execution of statements sequentially one after another.
  8. 8. b) Selection structure: selection structure involves a decision , based on a condition and may have 2 or more branches Eg: if else and switch statements. c) Looping structure: looping structure is used when a set of instructions is evaluated repeatedly. Eg: do, while, for statements.
  9. 9. • 1) 2) 3) 4) 5) 6) A well designed program will provide following benefits: Coding is easy and error-free. Testing is simple. Maintence is easy Good documentation is possible. Cost estimates can be made more accurately. Progress of coding may be controlled more precisely.
  10. 10. • 2) Program coding : progrm coding should be readable and simple to understand. • Complex logic and tricky coding should be avoided. • The elements of coding include: i) Internal documentation ii) Construction of statements iii) Generality of program iv) Input/Output formats
  11. 11. 3) Program testing: Testing is the process of reviewing and executing a program with the intent of detecting errors. • The compiler can detect syntactic and semantic errors, it cannot detect run-time and logical errors that show up during execution of program. • Testing should include necessary steps to detect all possible errors in the program. • Testing process may include following 2 stages: i) Human testing and ii) Computer-based testing.
  12. 12. a) Human testing : It is an effective errordetection Process and is done before the computer based testing begins. • Human testing methods include code inspection by programmer, code inspection by test group and review by peer group. • The test is carried out statement by statement and is analyzed with respect to check list of common programming errors. • In addition to finding errors, the programming style and choice of algorithm are reviewed.
  13. 13. b) Computer-based testing: computer based testing involves two stages namely: i) Compiler testing and ii) Run-time testing • Compiler testing is the simplest of two and detects undiscovered syntax errors. • The program executes when compiler detects no more errors. • Run-time errors may produce run-time error messages such as “null-pointer assignments” “stack overflow”. • When program is free from all such errors, it produces output.