program flow charting how to tackle the beginning stage a program design

44
Program Flow Charting How to tackle the beginning stage a program design

Post on 20-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Program Flow Charting

How to tackle the beginning stage a program design

2CMPE12c Gabriel Hugh Elkaim

A Program

Set of instructions written in a programming language that tells

the computer what to do

3CMPE12c Gabriel Hugh Elkaim

Programmers• Prepare instructions that make up the

program• Run the instructions to see if they

produce the correct results• Make corrections• Document the program• Interact with

– Users– Managers– Systems analysts

• Coordinate with other programmers to build a complete system

4CMPE12c Gabriel Hugh Elkaim

The Programming Process

• Defining the problem• Planning the solution• Coding the program• Testing the program• Documenting the program

5CMPE12c Gabriel Hugh Elkaim

The Programming Process: Defining the Problem

• What is the input• What output do you expect• How do you get from the input

to the output

6CMPE12c Gabriel Hugh Elkaim

The Programming Process: Planning the

Solution• Algorithms

– Detailed solutions to a given problem• Sorting records, adding sums of numbers,

etc..

• Design tools– Flowchart– Pseudocode

• Has logic structure, but no command syntax

7CMPE12c Gabriel Hugh Elkaim

• Desk-checking– Personal code design walk through

• Peer Reviews– “Code walk through”/structured walk

through

The Programming Process: Planning the Solution

8CMPE12c Gabriel Hugh Elkaim

The Origin of the Algorithm

From “The Cartoon Guide to Computer Science,” by Larry Gonick

9CMPE12c Gabriel Hugh Elkaim

10CMPE12c Gabriel Hugh Elkaim

11CMPE12c Gabriel Hugh Elkaim

12CMPE12c Gabriel Hugh Elkaim

The Indian Numerals

13CMPE12c Gabriel Hugh Elkaim

14CMPE12c Gabriel Hugh Elkaim

15CMPE12c Gabriel Hugh Elkaim

16CMPE12c Gabriel Hugh Elkaim

17CMPE12c Gabriel Hugh Elkaim

18CMPE12c Gabriel Hugh Elkaim

19CMPE12c Gabriel Hugh Elkaim

What defines an algorithm

20CMPE12c Gabriel Hugh Elkaim

21CMPE12c Gabriel Hugh Elkaim

22CMPE12c Gabriel Hugh Elkaim

23CMPE12c Gabriel Hugh Elkaim

Flow Control

Elements

The Programming Process: Planning the Solution

24CMPE12c Gabriel Hugh Elkaim

Needed Elements

Start/Stop

Process

Decision

Input/Output

Connector

25CMPE12c Gabriel Hugh Elkaim

The Programming Process: Planning the Solution

Accept series of numbers and display the average

26CMPE12c Gabriel Hugh Elkaim

27CMPE12c Gabriel Hugh Elkaim

28CMPE12c Gabriel Hugh Elkaim

29CMPE12c Gabriel Hugh Elkaim

30CMPE12c Gabriel Hugh Elkaim

The Programming Process: Coding the Program

• Translate algorithm into a formal programming language

• Within syntax of the language• How to key in the statements?

– Text editor– Programming environment – Interactive Development

Environment (IDE)

31CMPE12c Gabriel Hugh Elkaim

The Programming Process: Testing the Program• Translation – compiler

– Translates from source module into object module

– Detects syntax errors

• Link – linkage editor (linker)– Combines object module with libraries

to create load module– Finds undefined external references

• Debugging– Run using data that tests all statements– Logic errors

32CMPE12c Gabriel Hugh Elkaim

The Programming Process: Documenting the Program

• Performed throughout the development

• Material generated during each step– Problem definitions– Program plan– Comments within source code– Testing procedures– Narrative– Layouts of input and output– Program listing

33CMPE12c Gabriel Hugh Elkaim

• 1st Generation: Machine Level• 2nd Generation: Assembly Level• 3rd Generation: High Level

Procedural Level Languages

34CMPE12c Gabriel Hugh Elkaim

35CMPE12c Gabriel Hugh Elkaim

36CMPE12c Gabriel Hugh Elkaim

37CMPE12c Gabriel Hugh Elkaim

38CMPE12c Gabriel Hugh Elkaim

FORTRAN

Third Generation Languages

39CMPE12c Gabriel Hugh Elkaim

COBOL

Third Generation Languages

40CMPE12c Gabriel Hugh Elkaim

BASIC

Third Generation Languages

41CMPE12c Gabriel Hugh Elkaim

Third Generation Languages

C++

42CMPE12c Gabriel Hugh Elkaim

More Flow Charting Examples

43CMPE12c Gabriel Hugh Elkaim

44CMPE12c Gabriel Hugh Elkaim