110 likes | 254 Views
Detailed Design Representations (Chapter 9 of Code Complete ). Steve Chenoweth CSSE 375, Rose-Hulman Based on Don Bagert’s 2006 Lecture. Today (Mon, Sep 17, 2007). Review Reuse & Reusability Two topics – Detailed design & pseudocode – this Maintenance Management & Organization
E N D
Detailed Design Representations(Chapter 9 of Code Complete) Steve Chenoweth CSSE 375, Rose-Hulman Based on Don Bagert’s 2006 Lecture
Today (Mon, Sep 17, 2007) • Review Reuse & Reusability • Two topics – • Detailed design & pseudocode – this • Maintenance Management & Organization • Tonight – Turn in your team’s maintenance plan • Note: Exam, Wed night, Oct 3, 7 – 9 PM
Outline • Detailed Design Representations • Background • Pseudocode • Other Representations
Background • In some ways, detailed design is becoming a lost art • Nowadays, programmers often write source code directly from high-level design • Is this a good thing?
What is Pseudocode? • An informal, natural-language notation for describing an algorithm • Advantages: • Structure is similar to source code • Can describe various levels of detail
Example: Whether or not an integer is a prime number – 1/3 • First iteration (keeps to definition of prime number): If the integer < 2 Return false Else Determine whether there is a factor between 2 and the integer minus 1 If no factor is found Return true Else Return false End If End If
Example: Whether or not an integer is a prime number – 2/3 • Second iteration (Takes advantage of known facts): If the integer < 2 Return false Else if the integer = 2 Return true Else if the integer is even Return false Else Determine whether there is a factor between 3 and the square root of the integer If no factor is found Return true Else Return false End If End If
Example: Whether or not an integer is a prime number – 3/3 • Third iteration (Determination loop and variables included): If n < 2 Return false Else If n = 2 Return true Else If n is even Return false Else FactorNotFound = true Index = 3 While FactorNotFound and Index <= the square root of n do If Index is a factor of n FactorNotFound = false Else Index = Index + 2 End if End While Return FactorNotFound End if
Other Detailed Design Representations • Flowcharts • Classic • Examples: • http://www.tpub.com/neets/book22/93c.htm • http://www.fh-jena.de/~kleine/history/software/IBM-FlowchartingTechniques-GC20-8152-1.pdf (from 1969!) • Structured • Example: http://www.cs.umd.edu/hcil/members/bshneiderman/nsd • Control Structure Diagrams • jGRASP http://www.jgrasp.org/