13
STEPS FOR DEVELOPING A ‘C’ PROGRAM. BY SAHITHI NARAPARAJU

Steps for Developing a 'C' program

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Steps for Developing a 'C' program

STEPS FOR DEVELOPING A ‘C’ PROGRAM.

BYSAHITHI NARAPARAJU

Page 2: Steps for Developing a 'C' program

INTRODUCTION• The program development process in C includes three

important stages namely:

1) Program design

2) Program coding and

3) Program testing

• All the three stages contribute to production of high quality programs

Page 3: Steps for Developing a 'C' program

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.

Page 4: Steps for Developing a 'C' program

• 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.

Page 5: Steps for Developing a 'C' program

• 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

Page 6: Steps for Developing a 'C' program

• 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.

Page 7: Steps for Developing a 'C' program

• 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.

Page 8: Steps for Developing a 'C' program

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.

Page 9: Steps for Developing a 'C' program

• A well designed program will provide following benefits:

1) Coding is easy and error-free.

2) Testing is simple.

3) Maintence is easy

4) Good documentation is possible.

5) Cost estimates can be made more accurately.

6) Progress of coding may be controlled more precisely.

Page 10: Steps for Developing a 'C' program

• 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

Page 11: Steps for Developing a 'C' program

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 andii) Computer-based testing.

Page 12: Steps for Developing a 'C' program

a) Human testing : It is an effective error-detection

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.

Page 13: Steps for Developing a 'C' program

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.