E N D
Flow Charting Damian Gordon
Introduction • We mentioned it already, that if we thing of an analyst as being analogous to an architect, and a developer as being analogous to a builder, then the most important thing we can do as analysts is to explain our designs to the developers in a simple and clear way. • How do architects do this?
Flowcharts • So let’s say we want to express the following algorithm: • Read in a number and print it out.
START Read in A
START Read in A Print A
START Read in A Print A END
Flowcharts • So let’s say we want to express the following algorithm: • Read in a number and print it out double the number.
START Read in A
START Read in A Print A*2
START Read in A Print A*2 END
START Read in A
START Read in A B = A*2
START B = A * 2 can be read as “B gets the value of A multiplied by 2” Read in A B = A*2
START Read in A B = A*2 Print B
START Read in A B = A*2 Print B END
Flowcharts • So let’s say we want to express the following algorithm: • Read in a number, check if it is odd or even.
START Read in A
START Read in A Does A/2 give a remainder?
START Read in A Does A/2 give a remainder? Print “It’s Odd” Yes
START Read in A Does A/2 give a remainder? Print “It’s Odd” Print “It’s Even” No Yes
START Read in A Does A/2 give a remainder? Print “It’s Odd” Print “It’s Even” No Yes END
Flowcharts • So let’s say we want to express the following algorithm to print out the bigger of two numbers: • Read in two numbers, call them A and B. Is A is bigger than B, print out A, otherwise print out B.
START Read in A and B
START Read in A and B A>B?
START Read in A and B A>B? Print A Yes
START Read in A and B A>B? Print A Print B No Yes
START Read in A and B A>B? Print A Print B No Yes END
Flowcharts • So let’s say we want to express the following algorithm to print out the bigger of three numbers: • Read in three numbers, call them A, B and C. • If A is bigger than B, then if A is bigger than C, print out A, otherwise print out C. • If B is bigger than A, then if B is bigger than C, print out B, otherwise print out C.
START Read in A, B and C
START Read in A, B and C A>B?
START Read in A, B and C A>C? A>B? Yes
START Read in A, B and C A>C? A>B? B>C? No Yes
START Read in A, B and C A>C? A>B? B>C? No Yes No No Print C
START Read in A, B and C A>C? A>B? B>C? No Yes Yes No No Print A Print C
START Read in A, B and C A>C? A>B? B>C? No Yes Yes Yes No No Print A Print C Print B
START Read in A, B and C A>C? A>B? B>C? No Yes Yes Yes No No Print A Print C Print B END
Flowcharts • So let’s say we want to express the following algorithm: • Print out the numbers from 1 to 5
START Print 1
START Print 1 Print 2
START Print 1 Print 2 Print 3
START Print 1 Print 2 Print 3 Print 4