Download presentation
Presentation is loading. Please wait.
1
Flowcharts adapted from A Visual Tool for Logic Design and Program Planning, by Dr. Donald Bell, Cal Poly, 1999 updated April, 2010
2
What Is a Flowchart? zDiagram with lines (arrows) and symbols to show how something works ycan show how code works in a program xdefinition and symbols (programming)definition and symbols ycan also be used to help understand other processes xcriminal justice system flowchart (symbols somewhat different than for programming)criminal justice system flowchart
3
Flowcharts zReasons for using flowcharts ysimilar to reasons for using pseudocode zSpecial symbols used in flowcharts zRules for Successive Refinement
4
Purpose of Flowcharts zTo plan your logic prior to writing your program zCan be very helpful when you have complex conditional logic (the graphics help visualize the logic flow) zAssists in applying "successive refinement" ("top down" analysis) zCan also be used to document your logic ynot used as much with object oriented code
5
Successive Refinement zEqually applicable whether you use flowcharting or pseudocode zStart at the very "top level" ya one line statement of your program's purpose ybreak it down by stages into greater and greater levels of detail zSuccessive refinement stops when there is enough detail to write the program zEach flowchart symbol is a basic building block (like Tinker Toys or Lego blocks) Lego ythese are assembled into complex structures yassembled in specific ways
6
Flowcharting Symbols zLike pseudocode there are no fixed "standards", but there are conventions zFlowcharts use ovals, rectangles and diamondsovals, rectangles and diamonds yovals start and end the logic flow yrectangles are for imperative statements ydiamonds are for decisions zSome people use other symbols such as parallelograms for input and output, etc.
7
Rules for Applying Successive Refinement Using Flowcharts zCan replace one rectangular block with several more detailed ones zCan replace a rectangular block with one including logic or iteration (looping) zEach block has one entry point, and one exit point (very important!) ybut different statements can enter it there zFlow does not terminate until you get to a stop or end symbol
8
Rules for Applying Successive Refinement Using Flowcharts - 2 zStart with a simple chart that summarizes the whole system (high level view) yuse separate symbols for each major aspect, e.g., input, processing, output zDecompose each major aspect into a more detailed flow chart ye.g., input could decompose into: prompt user, read input, check input, if wrong give error message and prompt for good data
9
Flowcharts & OO Programs zFlowcharts use a sequential logic ytop to bottom zOO programming is often "event driven" yobjects fire methods in response to messages zHowever flowcharting is suitable for developing code within methods
10
UML Diagrams zIdentify tasks (use cases) zIdentify which object should handle a task zIdentify messages sent between objects zDraw objects and messages into a diagram yexample of a "use case diagram (which shows a class, properties, methods)example
11
Review zDraw flowcharts for sequence, selection and iteration control structures zDraw a flowchart for code that counts the number of students with GPAs of 3.0 or higher and then prints the total yWill need to use sequence, selection and iteration
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.