fit-unit3 chapter 1 -computer program

24
Unit III Chapter 01- computer program

Upload: raksharao

Post on 15-Jan-2017

228 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: FIT-Unit3 chapter 1 -computer program

Unit IIIChapter 01- computer program

Page 2: FIT-Unit3 chapter 1 -computer program

contents Introduction Developing a Program Program Development Life Cycle Algorithm Flowchart

› Flowchart Symbols,› Guidelines for Preparing Flowcharts,

Benefits and Limitations of Flowcharts

Page 3: FIT-Unit3 chapter 1 -computer program

Introduction Computer works on set of instruction called

computer program, which clearly specify the ways to carry out the task.

Users communicate with the computer using a language understood by it.

Developing a program Program development cycle

Page 4: FIT-Unit3 chapter 1 -computer program

Developing a program A program consists of a series of instructions that

a computer processes to perform the required operation.

It also includes some fixed data required to perform the instructions and process of defining the instructions and data.

A programmer must determine three basic rudiments:› The instructions to be performed.› The order in which those instructions are to be

performed.› The data required to perform those instructions.

Page 5: FIT-Unit3 chapter 1 -computer program

Program performing a task

C=A+BA, B C

INPUT PROCESSING OUTPUT

Page 6: FIT-Unit3 chapter 1 -computer program

Program development cycle Before starting the process of writing a program,

the programmer has to determine the problem that has to be solved.

The process of solving the problem runs in a loop.

Program development cycle, It includes several phase

There are 9 stages. Explained below.

Page 7: FIT-Unit3 chapter 1 -computer program

Program development cycle

Page 8: FIT-Unit3 chapter 1 -computer program

Problem analysis:› The problem is analyzed precisely and completely.› Based on the understanding, the programmer will know

about the scope within which the problem needs to be developed.

Page 9: FIT-Unit3 chapter 1 -computer program

Task analysis› After analysis of the problem, the developer needs to

develop solutions for various given problem.› From those, an optimal solution is chosen, which can be

solve comfortably and economically. Algorithm development

› After selecting appropriate solution, an algorithm has to be developed to depict the basic logic of the selected solution.

› An algorithm is represented by a flowchart, decision tables and pseudo codes

› Makes the program logic clear and help in coding.

Page 10: FIT-Unit3 chapter 1 -computer program

Algorithm testing› Before converting algorithm into code, it has to be

tested for accuracy.› Main purpose is to identify major logical errors at early

stage› Ensures that algorithm is true one

Coding› After meeting all design considerations, the actual

coding of the program takes place in chosen programming language.

› Depending upon the application domain , available resources application programming language is chosen.

Page 11: FIT-Unit3 chapter 1 -computer program

Testing and debugging› Its common that initial program to contain errors.› A program compiler and programmer-designed test data

machine tests the code for syntax errors.› Depending on the complexity of the program, several

rounds of testing may be required. Documentation

› Once the program is free from all kinds of errors, it is the duty of the programmer to document it appropriately.

› These documents should be supplied to program users.› It also helps another person to understand the program

clearly.

Page 12: FIT-Unit3 chapter 1 -computer program

Implementation› After documentation, the program is installed on the end

users machine and user is also provided with all essential documents in order to understand how to program works.

› The implementation can be viewed as the final testing because only after using the program the user can point out the drawback and report to the developers.

Maintenance and enhancement› After the program has been implemented, it should be

properly maintained by taking care of changing requirements of its users and the system.

› It generates user feedback, the program cycle continues as the program is modified or reconstructed to meet the changing needs.

Page 13: FIT-Unit3 chapter 1 -computer program

Algorithm Basic tool to develop the problem solving logic. An algorithm is defined as a finite sequence of

explicit instructions that when provided with a set of input values produces an output and then terminates.

Conditions for an algorithm› Steps must be unambiguous› Finite number of steps.› Can steps that repeat no. of times until task is

completed.› It should be general

Page 14: FIT-Unit3 chapter 1 -computer program

Algorithm to find largest of three numbers

1. Start2. Read three numbers A,B,C3. Find larger number between A and B and store it

in MAX_AB4. Find the larger number between MAX_AB and C

and store in MAX5. Display MAX6. stop

Page 15: FIT-Unit3 chapter 1 -computer program

flowchart A flowchart is a pictorial representation of an

algorithm in which steps are drawn in the form of different shapes of boxes and logical flow indicated by interconnected arrows.

Boxes represent operations and arrows represent the sequence in which operations are implemented.

Purpose of flowchart is to help the programmer in understanding the logic of the program.

It outlines the general procedure. Visual way of representing the information flow of

program

Page 16: FIT-Unit3 chapter 1 -computer program

Flowchart symbols

Page 17: FIT-Unit3 chapter 1 -computer program
Page 18: FIT-Unit3 chapter 1 -computer program

Guidelines for preparing flowcharts

The flowchart should be clear, neat and easy to follow

The flowchart must have logical start and finish In drawing a proper flowchart, all necessary

requirements should be listed in logical order. Only one flow line should come out from a

process symbol. Only one flow line should enter a decision

symbol, however 2 or 3 flow lines may leave the decision symbol.

Only one flow line is used with terminal symbol.

Page 19: FIT-Unit3 chapter 1 -computer program

Write briefly within symbols Incase of complex flowcharts, connector symbols

are reduced the number of flow lines. Intersection of flow lines must be avoided. It is used to test the validity if the flowchart by

passing through it with normal/unusual test data.

Page 20: FIT-Unit3 chapter 1 -computer program

Benefits of flowchart Makes logic clear

› provides pictorial representation of the task, which makes the logic easier to understand

› The symbols are connected in such a way that they show the movement of information through the system clearly.

› Even a person with less knowledge about the flowchart can trace the flowchart and understand the logic.

Communication› Flowchart are better way of communication of the logic

of the program.› Graphical representation is more effective than actual

code.

Page 21: FIT-Unit3 chapter 1 -computer program

Effective analysis› With flowchart, problem can be effectively analyzed.› Analysis is done by a person who does not know about

programming language. Useful in coding

› Act as blueprint or guides for the programmer to code the program

› Once flowchart is ready, programmers can easily code the program , the programmer will know where to end and where to start.

› As a result, error free programs are coded in a faster rate.

Page 22: FIT-Unit3 chapter 1 -computer program

Proper testing and debugging› helps in detecting errors , as the developers know

exactly what the logic should do.› Programmers can test it with various inputs to handle as

situations. Appropriate documentation

› Serve as very good program documentation tool.› They can take help of the documentation to know what

the program actually does and how to use the program.

Page 23: FIT-Unit3 chapter 1 -computer program

Limitations of flowcharts Complex

› When program is very large, flowcharts may run for pages together and making hard to follow.

› They become large very quickly and difficult to represent

Costly› Flowcharts are useful when problem solving logic of

straightforward and not very lengthy.› Flowcharts are to be drawn for huge applications , the

time and cost factor of program development.

Page 24: FIT-Unit3 chapter 1 -computer program

Difficult to modify› Any changes or modifications to flowchart usually

requires redrawing the entire logic again› Redrawing a complex flowchart, is a complex task.

No update› Usually programs are updated regularly› In case of large programs, update of flow charts may

not take place.› The logic used in the flowchart may not match with the

actual program’s logic› This defeats the main purpose of the flowchart.