160 likes | 176 Views
Design the program. Create a detailed description of program Use charts or ordinary language (pseudocode) Identify algorithms needed Algorithm: a step-by-step method to solve a problem or complete a task Algorithms must be: Well defined Well ordered Must produce some result
E N D
Design the program • Create a detailed description of program • Use charts or ordinary language (pseudocode) • Identify algorithms needed • Algorithm: a step-by-step method to solve a problem or complete a task • Algorithms must be: • Well defined • Well ordered • Must produce some result • Must terminate in a finite time
Documentation program • In-program documentation (remarks) • Program maintenance manual • For programming experts to help them fix or enhance code written by other programmers • Design documentation • Written by programmer to explain rationale behind methods and code used • Trade Study documentation • A research tool • An attempt to find the best solution
Using Flowchart Symbols and Pseudocode Statements • Flowchart: pictorial representation of the logic • Pseudocode: English-like representation of the logic • Example:
Structured Programming • A method for designing and coding programs in a systematic, organized manner • It combines the principles of top-down design, modularity and the use of the three accepted control structures of sequence, repetition and selection • Sequence, repetition and selection can be expressed in pseudocode, or with flowcharts
Flowcharts • A tool for programmers to design programs • Describes the flow of a program module’s execution with diagrams • Completely different from hierarchy charts • Connected symbols are used to describesequence, repetition, and selection structures • Some prefer to use flowcharting to learn how to express algorithms, and others prefer to use pseudocode • Many programs are designed with a combination of pseudocode and flowcharts
Flowchart Symbols Wiley text: page 100Auxiliary slideMany in Powerpoint
Flowlines: • Connect the steps • Show the sequence of statements • Have arrows to show the direction • Terminal symbol (start/stop symbol): • Shows the start and end points of the statements • Lozenge shape
Back-pointing arrows show statements that will be repeated (loop)
Infinite loop: a sequence of statements that repeats forever with no escape • Avoid infinite loops by testing for a predetermined value that means “stop processing” • Decision: testing a value • Flowchart decision symbol: a diamond shape, with two flowlines, one for Yes and one for No Into decision Answer = Yes Answer = No Askquestion
Sentinel value (or dummy value) • Does not represent real data • Signal to stop • Can be used with input from files or from users • End-of-file (EOF) marker: • Code stored in the file that marks the end of the data • Usually used instead of a sentinel value for file input
Flowchart connector symbol: • Marks a logic transfer to another location in the flowchart • Transfer location can be on the same page or on another page • On-page symbol: a circle with a number or letter to identify the matching transfer location • Off-page symbol: a square with a pointed bottom, containing page number and a number of letter to identify the matching transfer location
On page: to Off page: to On page: from