Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPS120 Introduction to Computer Programming The Programming Process.

Similar presentations


Presentation on theme: "CPS120 Introduction to Computer Programming The Programming Process."— Presentation transcript:

1 CPS120 Introduction to Computer Programming The Programming Process

2 Analyze the problem Design the solution algorithm Design the user interface Write the code Test and debug the program Complete the documentation The Program Development Cycle

3 Programs A program is a set of step- by-step instructions that directs the computer to do the tasks you want it to do and produce the results you want.

4 Programming Languages A programming language is a set of rules that provides a way of telling a computer what operations to perform.

5 What Can a Program Do? A program can only instruct a computer to: –Read Input –Sequence –Calculate –Store data –Compare and branch –Iterate or Loop –Write Output

6 Sequence Control Structures Sequence control structures direct the order of program instructions. The fact that one instruction follows another—in sequence—establishes the control and order of operations.

7 Calculate A program can instruct a computer to perform mathematical operations. Add 1 to Counter

8 Store A program will often instruct a computer to store intermediate results. Place 1 in Counter

9 Compare and Branch A program can instruct a computer to compare two items and do something based on a match or mismatch which, in turn, redirect the sequence of programming instructions. –There are two forms: IF-THEN IF-THEN-ELSE

10 IF-THEN Test condition p falsetrue Entry Exit True statement a

11 IF-THEN-ELSE falsetrue Entry Exit Test condition p “true” statement a “false” statement a

12 Iterate A program loop is a form of iteration. A computer can be instructed to repeat instructions under certain conditions. No

13 Iteration Control Structures Iteration control structures are looping mechanisms. Loops repeat an activity until stopped. The location of the stopping mechanism determines how the loop will work: –Leading decisions –Trailing decisions

14 Leading Decisions If the stop is at the beginning of the iteration, then the control is called a leading decision. The command DO WHILE performs the iteration and places the stop at the beginning.

15 DO WHILE Loop No Yes Entry Exit Test condition p Loop statement a

16 Trailing Decisions If the stop is at the end of the iteration, the control mechanism is called a trailing decision. The command DO UNTIL performs the iteration and puts the stop at the end of the loop.

17 DO UNTIL Loop Loop statement a NoYes Entry Test condition p Exit

18 Analyze the problem Design the solution algorithm Design the user interface Write the code Test and debug the program Complete the documentation The Program Development Cycle

19 Testing the Algorithm The process itself must be tested Testing at the algorithm development phase involves looking at each level of the top- down design

20 Testing the Algorithm Desk checking: sit at a desk with a pencil and paper and work through the design Walk-through: Manual simulation of the design by the team members –Take sample data values and simulate the design using the sample data Inspection: The design is handed out in advance, and one person (not the designer) reads the design line by line while the others point out errors


Download ppt "CPS120 Introduction to Computer Programming The Programming Process."

Similar presentations


Ads by Google