Beruflich Dokumente
Kultur Dokumente
Requirements Analysis
Process Phase Introduced in This Chapter Design Framework Architecture Detailed Design
Implementation
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Key Concept:
In development, we start by thinking about architecture, and end with programming. For learning purposes, this book begins by discussing programming, and ends by explaining architecture.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Preconditions: conditions on non-local variables that the methods code assumes Programming Conventions:
o Includes parameters Method Documentation 1 of 2 o Verification of these conditions not promised in method itself
Invariants: relationships among non-local variables that the functions execution do not change
(The values of the individual variables may change, however.) o Equivalent to inclusion in both pre- and post-conditions o There may also be invariants among local variables
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Return:
o What the method returns
Known issues:
o Honest statement of what has to be done, defects that have not been repaired etc. o (Obviously) limited to whats known!
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Key Concept:
Specifying Methods
We specify each method in its comment section with preconditions, postconditions, return, invariants and known issues.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Nominal path
Parameter name too long
else
protected final void setName( String aName ) { // Check legitimacy of parameter and settings if( ( aName == null ) || ( maxNumCharsInName() <= 0 ) || ( maxNumCharsInName() > alltimeLimitOfNameLength() ) ) { name = new String( "defaultName" ); System.out.println ( "defaultName selected by GameCharacter.setName()"); } else // Truncate if aName too long if( aName.length() > maxNumCharsInName() ) name = new String ( aName.getBytes(), 0, maxNumCharsInName() ); else // assign the parameter name name = new String( aName ); }
Truncate name
Flowchart Example
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
FOR number of microseconds supplied by operator IF number of microseconds exceeds critical value Try to get supervisor's approval IF no supervisor's approval abort with "no supervisor approval for unusual duration" message ENDIF Pseuodocode Example For an X-ray Controller ENDIF IF power level exceeds critical value abort with "power level exceeded" message ENDIF IF ( patient properly aligned & shield properly placed & machine self-test passed ) Apply X-ray at power level p ENDIF ENDFOR Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Clarify algorithms in many cases Impose increased discipline on the process of documenting detailed design Provide additional level at which inspection can be performed
y Help to trap defects before they become code y Increases product reliability
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Key Concept:
Preconditions etc. specify what a method accomplishes. Activity charts etc. describe how the method accomplishes these.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
replace?
Check loop counters, especially for range correctness Avoid nesting loops more than 3 levels
o introduce auxiliary methods to avoid
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Not clear what some of the method are meant to do (documentation) * See appendix to this chapter
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Hard to modify, add or remove parts. (flexibility) Executes fast enough? (speed efficiency) Satisfies memory requirements? (space efficiency)
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Key Concept:
Ensure Correctness
We are primarily responsible for ensuring that our code does what its intended to.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
else
return
Exception
else
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Key Concept:
The code here is more robust, but it does not exploit object-orientation or exhibit a clear design. Consequently, its inflexible, not easy to verify, and unlikely to be reused.
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Key Concept:
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Changing functionality
o Example: allow withdrawals to create an overdraft
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Types of Reuse
o Example: sharing dlls between word processor and spreadsheet o To be covered in the Components chapters xx - xx
Key Concept:
Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.
Reusability doubtful
o OO not leveraged