Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Program Design Phases

Similar presentations


Presentation on theme: "The Program Design Phases"— Presentation transcript:

1 The Program Design Phases
Propose and evaluate solutions Determine the most efficient solution Develop and represent the algorithm Test and validate the solution Define the problem

2 Programs are Solutions to Problems
Programmers can represent their solutions in several ways : Structure Charts Pseudocode Flowcharts These are the tools used in structured programming

3 Structured Programming
Structured program languages lend themselves to flowcharts, structure charts, and pseudocode. Structured programming languages work best where the instructions have been broken up into small, manageable parts (procedures/modules).

4 Pseudocode This device is not visual but is considered a “first draft” of the actual program. Pseudocode is written in the programmer’s native language and concentrates on the logic in a program — not the syntax of a programming language.

5 Flowcharts A flowchart is a pictorial representation of all the steps in a process. ( A picture is worth a 1000 words ) There are Block flowcharts, System flowcharts, Procedure flowcharts and Program flowcharts

6 PROGRAM FLOWCHARTS These represent the flow of logic in a program and help programmers “see” program design. They are also sometimes called logic flowcharts. Flow charts are drawn in the design phase of programming. A flowchart is comprised of specialised symbols and flow lines. Each symbol contains information about what must be done at that point; and the arrow shows the flow of execution.

7 PROGRAM FLOWCHARTS cont’d
… show the step by step sequence of operations carried out by a computer program the start and end of the program the input and output operations how the data is processed the main sections of the program Program flowcharts should be sufficiently detailed for the program code to be written directly from it, making it, therefore, just like pseudocode

8 PROGRAM FLOWCHARTS cont’d
The most common flowchart symbols are :

9 PROGRAM FLOWCHARTS cont’d
The start / end symbol Each flowchart must begin and end with the terminator symbol. The word START or END is written inside the oval

10 PROGRAM FLOWCHARTS cont’d
START END

11 PROGRAM FLOWCHARTS cont’d
The process symbol This indicates an operation such as a calculation Details are written in the rectangle and should begin with a verb

12 PROGRAM FLOWCHARTS cont’d
Add number to subtotal

13 PROGRAM FLOWCHARTS cont’d
The input / output symbol This marks the point at which we get data or give results. The input or output is written inside the parallelogram.

14 PROGRAM FLOWCHARTS cont’d
Input name

15 PROGRAM FLOWCHARTS cont’d
The decision symbol This is used where a decision has to be made in selecting the subsequent path to be followed. Note that while there is only one entry point to the diamond there are at least 2 exits

16 PROGRAM FLOWCHARTS cont’d
Even number ? Yes No

17 PROGRAM FLOWCHARTS cont’d
The pre-defined process symbol This is used to represent a process which is broken down elsewhere

18 PROGRAM FLOWCHARTS cont’d
Sort Marks

19 PROGRAM FLOWCHARTS cont’d
The connector symbols Connector Off-page connector These are used to break and continue links without crisscrossing lines all over the place. So they link with another part of the program or another page.

20 PROGRAM FLOWCHARTS cont’d
B A A B

21 Drawing Flow Charts Organize the flowchart in modules
Use standard symbols only, you can vary the size but not the shape Try to keep the logic as flowing from top to bottom and from left to right Do not cross flow lines Use a template if possible Add notes if necessary for clarity but not not clutter

22 PROGRAM FLOWCHARTS cont’d
Combining symbols Sequence of steps START Step 1 Step 2 Step 3 END

23 PROGRAM FLOWCHARTS cont’d
Combining symbols Decision (if statement) n = sum + grade N > 50? Yes No Give certificate END

24 PROGRAM FLOWCHARTS cont’d
Combining symbols Loops WHILE loop ( loops involve a) decisions and branching {if statements} b) Returning to previous statements ) n = n + 1 N < 50? False True < an action > < action continuing program >

25 PROGRAM FLOWCHARTS cont’d
Combining symbols Loops REPEAT loop In a REPEAT loop the action takes place before the first check n = n + 1 < an action > N < 50? False < action continuing program > True

26 CASH REGISTER PROGRAM Start Sum = 0 Input price Sum = sum + price More
items? Tax = sum x 0.15 Output sum, tax, End No Yes CASH REGISTER PROGRAM

27 Common Flowchart Symbols
Terminator. Shows the starting and ending points of the program. A terminator has flow lines in only one direction, either in (a stop node) or out (a start node). Data Input or Output. Allows the user to input data and results to be displayed. Processing. Indicates an operation performed by the computer, such as a variable assignment or mathematical operation. Decision. The diamond indicates a decision structure. A diamond always has two Flow lines out. One flow line out is labeled the “yes” branch and the other is labeled the “no” branch. Predefined Process. One statement denotes a group of previously defined statements. For instance, “Calculate m!” indicates that the program executes the necessary commands to compute m factorial. Connector. Connectors avoid crossing flow lines, making the flowchart easier to read. Connectors indicate where flow lines are connected. Connectors come in pairs, one with a flow line in and the other with a flow line out. Off-page connector. Even fairly small programs can have flowcharts that extend several pages. The off-page connector indicates the continuation of the flowchart on another page. Just like connectors, off-page connectors come in pairs. Flow line. Flow lines connect the flowchart symbols and show the sequence of operations during the program execution. Common Flowchart Symbols

28 FYI : Other Symbols - - - - - - annotation / notes
tape disk display document

29 Benefits of Flowcharts
Communication : a better way of communicating because they are visual Effective analysis : the visual nature allows quick grasp of program logic Aids in technical documentation Good guide when it is time to code Good aid when program maintenance becomes necessary

30 Draw Backs of Flowcharts
When programs are large or complex, the chart becomes too complicated If alterations are required, the entire chart may have to be re-drawn Because of this, the use of program flowcharts is actually in decline


Download ppt "The Program Design Phases"

Similar presentations


Ads by Google