Presentation is loading. Please wait.

Presentation is loading. Please wait.

Structured Programming structured programming: A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having.

Similar presentations


Presentation on theme: "Structured Programming structured programming: A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having."— Presentation transcript:

1 Structured Programming structured programming: A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having a single entry and a single exit point, and in which control is passed downward through the structure without unconditional branches to higher levels of the structure. Three types of control flow are used: sequential, test, and iteration.

2 Advantages of Structured Programming Easy to write: Modular design increases the programmer's productivity by allowing them to look at the big picture first and focus on details later. Several Programmers can work on a single, large program, each working on a different module Studies show structured programs take less time to write than standard programs. Procedures written for one program can be reused in other programs requiring the same task. A procedure that can be used in many programs is said to be reusable

3 Easy to debug Since each procedure is specialized to perform just one task, a procedure can be checked individually. Older unstructured programs consist of a sequence of instructions that are not grouped for specific tasks. The logic of such programs is cluttered with details and therefore difficult to follow. Easy to Understand The relationship between the procedures shows the modular design of the program. Meaningful procedure names and clear documentation identify the task performed by each module Meaningful variable names help the programmer identify the purpose of each variable. Easy to Change Since a correctly written structured program is self-documenting, it can be easily understood by another programmer.

4 Top Down Design Top Down Design is a method of designing something that starts with the complete item then breaks it down into smaller and smaller components. In programming it means breaking a difficult task down (divide and conquer) and solving pieces independently until every step can easily be implemented (successive refinement).

5 Dog House Example 1. Floor or Base 2. Walls –2.1 Back Wall –2.1.1 Top section 2.1.2 Lower section – 2.2. Left Wall 2.3 Right Wall 2.4 Front Wall –2.4.1 Top section 2.4.2 Door section 3. Roof –3.1 Left Side 3.2 Right Side

6 Prepare all sections as described below then join sections using nails and glue as specified. 1. Floor or Base - cut to specified size and smooth edges 2. Walls –2.1 Back Wall –2.1.1 Top section - cut triangular shape 2.1.2 Lower section - cut square shape and glue and staple to upper part of wall – 2.2. Left Wall - cut to specified dimensions 2.3 Right Wall - cut to specified dimensions 2.4 Front Wall –2.4.1 Top section - cut triangular piece to specified dimensions 2.4.2 Door section - use jigsaw to cut U shape for the door in square shape, staple and glue to top section 3. Roof –3.1 Left Side - cut to specified dimensions 3.2 Right Side - cut to specified dimensions

7

8  Hierarchical systems seem to have a property that something considered as an undivided entity on one level is considered as a composite object on the next lowest level of greater detail: as a result, the natural grain of space or time that is applicable at each level decreases by an order of magnitude when we shift our attention from one level to the next lower one. We understand walls in terms of bricks, bricks in terms of crystals, crystals in terms of molecules, etc.-- ---E. Dijkstra

9  The Fundamental Principle of Structured Programming is that at all times and under all circumstances, the programmer must keep the program within his intellectual grasp. The well-known methods for achieving this can be briefly summarized as follows: 1) top-down design and construction, 2) limited control structures, and 3) limited scope of data structures.-----Tom Harbron  A study of program structure has revealed that programs can differ tremendously in their intellectual manageability. A number of rules have been discovered, violations of which will either seriously impair or totally destroy the intellectual manageability of the program....I now suggest that we confine ourselves to the design and implementation of intellectually manageable programs.-----E. Dijkstra


Download ppt "Structured Programming structured programming: A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having."

Similar presentations


Ads by Google