SlideShare une entreprise Scribd logo
1  sur  19
RECOGNIZING
STRUCTURES
Recognizing Structures
 When you are beginning to learn about
structured program design, it is difficult to
detect whether a flowchart of a program’s logic
is structured.
 In recognizing structure, the three basic
structures must be taken into consideration.
 By recognizing its structure we can identify if
there are tangled or unstructured flowchart
segments.
Example 1:
 Does the flowchart
segment
structured?
 How many
structures does
the flowchart
segment have?
 What structures do
you recognize
from the flowchart
segment?
Sequence
Selection
Figure 1
Example 2:
 Does the flowchart
segment
structured?
 How many
structures does
the flowchart
segment have?
 What structures do
you recognize
from the flowchart
segment?
Loop
Selection
Figure 2
Example 3:
 Does the
flowchart
segment
structured?
 No, it is not built
from the three
basic structures.
Figure 3
This part of
the segment
is not
structured
Spaghetti Bowl Method
 One way to straighten out an unstructured
flowchart segment is to use the “spaghetti
bowl” method.
 That is, picture the flowchart as a bowl of
spaghetti that you must untangle. Imagine you
can grab one piece of pasta at the top of the
bowl and start pulling. As you “pull” each
symbol out of the tangled mess, you can
untangle the separate paths until the entire
segment is structured.
Spaghetti Bowl Method (cont’d.)
 Use the Spaghetti Bowl Method to structure
the flowchart segment
 Start pulling at Figure 3 top
 Encounter procedure box Labeled A (Figure 3-1)
Figure 3-1 Untangling Example 3, first step
Spaghetti Bowl Method (cont’d.)
 Next item is a question
 Testing condition labeled B (Figure 3-2)
 Now know sequence starting with A ended
Figure 3-2 Untangling Example 3, second step
Spaghetti Bowl Method (cont’d.)
 Pull flowline from “No” side of Question B
 Encounter C (Figure 3-3)
Figure 3-3 Untangling Example 3, third step
Spaghetti Bowl Method (cont’d.)
 Pull flowline from “Yes” side of Question B
 Encounter D (Figure 3-4)
Figure 3-4 Untangling Example 3, fourth step
Spaghetti Bowl Method (cont’d.)
 Follow line on left side of Question D
 If line attached somewhere, untangle by repeating
tangled step
 Continue pulling flowline emerging from Step
C
 Reach end of program segment (Figure 3-5)
Figure 3-5 Untangling Example 3, fifth step
Spaghetti Bowl Method (cont’d.)
 Pull right side of Question D
 Process E pops up (Figure 2-6)
 Reached the end
Figure 2-6 Untangling Example 3, sixth step
Spaghetti Bowl Method (cont’d.)
 Question D brought together: selection
structure
 Question B loose ends brought together:
selection structure
Figure 3 Finished flowchart and
pseudo code for untangling
Example 3
Describing Three Special
Structures –
Case, While and Do-Until
 Three more forms of basic structures
 Case
 Alternative decision-making structure
 Do-while
 Alternative to while loop
 Do-until loops
 Alternative to while loop
 Sometimes convenient
 All acceptable, legal structures
The Case Structure
 Several possible values exists for single
variable being tested
 Each value requires different course of action
 Flow passes through only one alternative
 Flowchart, pseudo code, program code
convenience
 Easier to understand at first glance
 Examples
 Figure 4-1: series of decisions
 Figure 4-2: case structure implementing decisions
The Case Structure (cont’d.)
Figure 4-1 Flowchart and pseudo code of tuition
decisions
The Case Structure (cont’d.)
Figure 4-2 Flowchart
and pseudo code of
case structure
The While Loop
 while loop
 Condition tested at structure beginning
 Condition not met at first test
 Code in while structure body never executed
 Also called a pretest loop
Figure 4-3 The while loop
The Do-While or Do-Until Loops
 do-while loop
 Condition tested at structure end
 Body has executed at least once
 Expressed as a sequence followed by a loop
 Also called a posttest loop
Figure 4-4 The do-while or do-until loop

Contenu connexe

Plus de MattFlordeliza1

web host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptxweb host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptxMattFlordeliza1
 
bootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptxbootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptxMattFlordeliza1
 
JDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxJDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxMattFlordeliza1
 
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxMattFlordeliza1
 
PLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxPLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxMattFlordeliza1
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxMattFlordeliza1
 

Plus de MattFlordeliza1 (8)

web host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptxweb host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptx
 
bootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptxbootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptx
 
JDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxJDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptx
 
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptx
 
PLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxPLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptx
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptx
 
www module 1.pptx
www module 1.pptxwww module 1.pptx
www module 1.pptx
 
QUEUE.pptx
QUEUE.pptxQUEUE.pptx
QUEUE.pptx
 

Dernier

Washington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers ShirtWashington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers Shirtrahman018755
 
一比一定制美国罗格斯大学毕业证学位证书
一比一定制美国罗格斯大学毕业证学位证书一比一定制美国罗格斯大学毕业证学位证书
一比一定制美国罗格斯大学毕业证学位证书A
 
TOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide HandbookTOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide HandbookVarun Mithran
 
一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理A
 
一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理SS
 
The Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfThe Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfe-Market Hub
 
Dan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat HoodieDan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat Hoodierahman018755
 
一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书A
 
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformonhackersuli
 
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理apekaom
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理F
 
Abortion Pills In Jeddah+966572737505 & Get cytotec Jeddah
Abortion Pills In Jeddah+966572737505 & Get cytotec JeddahAbortion Pills In Jeddah+966572737505 & Get cytotec Jeddah
Abortion Pills In Jeddah+966572737505 & Get cytotec Jeddahmarufhussain782445
 
原版定制美国加州大学河滨分校毕业证原件一模一样
原版定制美国加州大学河滨分校毕业证原件一模一样原版定制美国加州大学河滨分校毕业证原件一模一样
原版定制美国加州大学河滨分校毕业证原件一模一样A
 
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书AS
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowIdeoholics
 
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样AS
 
Beyond Inbound: Unlocking the Secrets of API Egress Traffic Management
Beyond Inbound: Unlocking the Secrets of API Egress Traffic ManagementBeyond Inbound: Unlocking the Secrets of API Egress Traffic Management
Beyond Inbound: Unlocking the Secrets of API Egress Traffic Managementseank14
 
Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303Dewi Agency
 
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样Fi
 
原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样AS
 

Dernier (20)

Washington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers ShirtWashington Football Commanders Redskins Feathers Shirt
Washington Football Commanders Redskins Feathers Shirt
 
一比一定制美国罗格斯大学毕业证学位证书
一比一定制美国罗格斯大学毕业证学位证书一比一定制美国罗格斯大学毕业证学位证书
一比一定制美国罗格斯大学毕业证学位证书
 
TOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide HandbookTOP 100 Vulnerabilities Step-by-Step Guide Handbook
TOP 100 Vulnerabilities Step-by-Step Guide Handbook
 
一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理一比一原版美国北卡罗莱纳大学毕业证如何办理
一比一原版美国北卡罗莱纳大学毕业证如何办理
 
一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理一比一原版澳大利亚迪肯大学毕业证如何办理
一比一原版澳大利亚迪肯大学毕业证如何办理
 
The Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdfThe Rise of Subscription-Based Digital Services.pdf
The Rise of Subscription-Based Digital Services.pdf
 
Dan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat HoodieDan Quinn Commanders Feather Dad Hat Hoodie
Dan Quinn Commanders Feather Dad Hat Hoodie
 
一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书一比一定制波士顿学院毕业证学位证书
一比一定制波士顿学院毕业证学位证书
 
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
[Hackersuli] Élő szövet a fémvázon: Python és gépi tanulás a Zeek platformon
 
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
一比一原版桑佛德大学毕业证成绩单申请学校Offer快速办理
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
Abortion Pills In Jeddah+966572737505 & Get cytotec Jeddah
Abortion Pills In Jeddah+966572737505 & Get cytotec JeddahAbortion Pills In Jeddah+966572737505 & Get cytotec Jeddah
Abortion Pills In Jeddah+966572737505 & Get cytotec Jeddah
 
原版定制美国加州大学河滨分校毕业证原件一模一样
原版定制美国加州大学河滨分校毕业证原件一模一样原版定制美国加州大学河滨分校毕业证原件一模一样
原版定制美国加州大学河滨分校毕业证原件一模一样
 
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
一比一定制(Waikato毕业证书)新西兰怀卡托大学毕业证学位证书
 
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download NowHUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
HUMANIZE YOUR BRAND - FREE E-WORKBOOK Download Now
 
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
一比一原版(Wintec毕业证书)新西兰怀卡托理工学院毕业证原件一模一样
 
Beyond Inbound: Unlocking the Secrets of API Egress Traffic Management
Beyond Inbound: Unlocking the Secrets of API Egress Traffic ManagementBeyond Inbound: Unlocking the Secrets of API Egress Traffic Management
Beyond Inbound: Unlocking the Secrets of API Egress Traffic Management
 
Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303Lowongan Kerja LC Yogyakarta Terbaru 085746015303
Lowongan Kerja LC Yogyakarta Terbaru 085746015303
 
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
一比一原版(Soton毕业证书)南安普顿大学毕业证原件一模一样
 
原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样原版定制英国赫瑞瓦特大学毕业证原件一模一样
原版定制英国赫瑞瓦特大学毕业证原件一模一样
 

PLF-Lesson-5 programming in TSU lec.pptx

  • 2. Recognizing Structures  When you are beginning to learn about structured program design, it is difficult to detect whether a flowchart of a program’s logic is structured.  In recognizing structure, the three basic structures must be taken into consideration.  By recognizing its structure we can identify if there are tangled or unstructured flowchart segments.
  • 3. Example 1:  Does the flowchart segment structured?  How many structures does the flowchart segment have?  What structures do you recognize from the flowchart segment? Sequence Selection Figure 1
  • 4. Example 2:  Does the flowchart segment structured?  How many structures does the flowchart segment have?  What structures do you recognize from the flowchart segment? Loop Selection Figure 2
  • 5. Example 3:  Does the flowchart segment structured?  No, it is not built from the three basic structures. Figure 3 This part of the segment is not structured
  • 6. Spaghetti Bowl Method  One way to straighten out an unstructured flowchart segment is to use the “spaghetti bowl” method.  That is, picture the flowchart as a bowl of spaghetti that you must untangle. Imagine you can grab one piece of pasta at the top of the bowl and start pulling. As you “pull” each symbol out of the tangled mess, you can untangle the separate paths until the entire segment is structured.
  • 7. Spaghetti Bowl Method (cont’d.)  Use the Spaghetti Bowl Method to structure the flowchart segment  Start pulling at Figure 3 top  Encounter procedure box Labeled A (Figure 3-1) Figure 3-1 Untangling Example 3, first step
  • 8. Spaghetti Bowl Method (cont’d.)  Next item is a question  Testing condition labeled B (Figure 3-2)  Now know sequence starting with A ended Figure 3-2 Untangling Example 3, second step
  • 9. Spaghetti Bowl Method (cont’d.)  Pull flowline from “No” side of Question B  Encounter C (Figure 3-3) Figure 3-3 Untangling Example 3, third step
  • 10. Spaghetti Bowl Method (cont’d.)  Pull flowline from “Yes” side of Question B  Encounter D (Figure 3-4) Figure 3-4 Untangling Example 3, fourth step
  • 11. Spaghetti Bowl Method (cont’d.)  Follow line on left side of Question D  If line attached somewhere, untangle by repeating tangled step  Continue pulling flowline emerging from Step C  Reach end of program segment (Figure 3-5) Figure 3-5 Untangling Example 3, fifth step
  • 12. Spaghetti Bowl Method (cont’d.)  Pull right side of Question D  Process E pops up (Figure 2-6)  Reached the end Figure 2-6 Untangling Example 3, sixth step
  • 13. Spaghetti Bowl Method (cont’d.)  Question D brought together: selection structure  Question B loose ends brought together: selection structure Figure 3 Finished flowchart and pseudo code for untangling Example 3
  • 14. Describing Three Special Structures – Case, While and Do-Until  Three more forms of basic structures  Case  Alternative decision-making structure  Do-while  Alternative to while loop  Do-until loops  Alternative to while loop  Sometimes convenient  All acceptable, legal structures
  • 15. The Case Structure  Several possible values exists for single variable being tested  Each value requires different course of action  Flow passes through only one alternative  Flowchart, pseudo code, program code convenience  Easier to understand at first glance  Examples  Figure 4-1: series of decisions  Figure 4-2: case structure implementing decisions
  • 16. The Case Structure (cont’d.) Figure 4-1 Flowchart and pseudo code of tuition decisions
  • 17. The Case Structure (cont’d.) Figure 4-2 Flowchart and pseudo code of case structure
  • 18. The While Loop  while loop  Condition tested at structure beginning  Condition not met at first test  Code in while structure body never executed  Also called a pretest loop Figure 4-3 The while loop
  • 19. The Do-While or Do-Until Loops  do-while loop  Condition tested at structure end  Body has executed at least once  Expressed as a sequence followed by a loop  Also called a posttest loop Figure 4-4 The do-while or do-until loop

Notes de l'éditeur

  1. Yes it is structured.. 2 structures Sequence and Selection NOTE: notice that the segment has only one entry point and exit point.
  2. Yes it is structured.. 2 structures Loop and a Selection within the Loop NOTE: notice that the segment has only one entry point and exit point.