Click here to load reader

The art of drawing a road map Flowchart. Symbols Oval (“racetrack”) Start or Stop (Terminator) Rectangle Process (calculation, value assignment, etc)

Embed Size (px)

Citation preview

Flowchart

The art of drawing a road mapFlowchartSymbolsOval (racetrack)Start or Stop (Terminator)RectangleProcess (calculation, value assignment, etc)Rectangle with double vertical sidesA predefined processAllows you to represent something complicated at an early stage and basically show that it goes here in your flow of activityRhomboid (slanted rectangle)Input / output (data)DiamondDecisionArrows indicate direction or flow of activitySmall circle (possibly with letter inside)on page continuationHome Plateoff page continuationCalculate AvgAvgGradesPerform Tax CalculationStartGet TempCentAge>21?AFlowchartDemonstrates a sequence of activities and decisionsCan be used as a roadmap in writing codeCertain shapes identify code structuresDecision structuresA condition which evaluates to True or FalseAsks a question which directs the continued flow of activityRepetition structures (loops)A return to a prior point in the flowchartNOTE: this return is based on a condition being either true or falseWhile the shape asking the question is a diamond and could be an IF statement, the fact that one of the branches from the diamond returns to a prior point indicates that the conditional question asked is part of a LOOP and not an IFFlowchartForces us to think about what we doWe need to identify each discrete action (process) or question (decision) in order to solve the problemFlowcharts can identify that we missed somethingWe have a process which calculates GROSSPAY, and know that GROSSPAY requires Hoursworked and HourlyPay as input, but we notice that prior to the calculation, we never bothered to get HoursWorked (missing input)Weve calculated a result NETPAY, however never display it to the user (output of our solution)Flowcharts can identify a sequencing errorWe display a result prior to calculating itWe can think about things more abstractlyCalculate GrosspayIf we know someone worked 10 hours at $15/hour the calculation is 10 x 15NOT abstract enough it only works for that single caseWork backwards. What does the 10 represent? [ Hoursworked]Use THAT name to represent any value given ATM Password ValidationThe user gets 3 attempts to provide the valid passwordIf validGo to the process transaction off-page routineIf its the 3rd failed attemptStop!DecisionValid diamondRepetition3rd attempt question is part of the LOOP, and not simply an IFHow you can identify the difference between which structure to code (IF vs. LOOP)

IF statement / variationsIFblnPass=False If AvgGrade > 65 then blnPass=TRUE

IF ..ELSE..ENDIFIf AvgGrade > 65 thenblnPass=TrueElseblnPass = FalseEnd If

IF .. ELSEIF ENDIFIf Avg >=90 thenLG = AElseIf Avg >= 80LG = BElseIf Avg >= 70LG = CElseLG = FEnd If

Filling in symbolsProcessesUse a verb or action wordThink of each process as its own little IPO (Input-Process-Output)Do you have all of the required inputs to do the process at that point in time?If not, maybe you missed a step somewhereDecisionsTrue or falseComparisonAge>21Counter