Presentation is loading. Please wait.

Presentation is loading. Please wait.

Structured Programming

Similar presentations


Presentation on theme: "Structured Programming"— Presentation transcript:

1 Structured Programming

2 Goto hell Goto : unconstrained jump Any jump in assembly
Exists in C/C++ 

3 GOTO Considered Harmful
"For a number of years I have been familiar with the observation that the quality of programmers is a decreasing function of the density of go to statements in the programs they produce. More recently I discovered why the use of the go to statement has such disastrous effects, and I became convinced that the go to statement should be abolished from all "higher level" programming languages (i.e. everything except, perhaps, plain machine code)." -Edsger Djikstra

4 A program Clear implementation of 4*(4 + 12)

5 A program Ugly implementation of 4*( )

6 Block Block : List of instructions with 1 entry and 1 exit

7 Block Block : List of instructions with 1 entry and 1 exit Defined
Entry conditions : Exit conditions : answer in r1

8 Structured Programming
A block is structured If entry conditions met and no bugs, exit conditions will be met

9 Structured Programming
A sequence of blocks are structured if exit conditions for block 1 match entry for block 2

10 Structured Programming
Alternation is structured if both branches end at same location with same exit conditions

11 Structured Programming
Iteration of a code block is structured

12 Structured Programming
Any block can be used inside any other

13 Universality Any program can be written in structured format:


Download ppt "Structured Programming"

Similar presentations


Ads by Google