design. quick summary what you have learnt so far? different kinds of software engineering...
TRANSCRIPT
![Page 1: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/1.jpg)
DESIGN
![Page 2: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/2.jpg)
Quick Summary
What you have learnt so far? Different kinds of software engineering methodology
Waterfall model Spiral model Unified process
Requirements :Use cases Traditional specification: semi-formal
DFD Formal specification: Z, FSM, Petric Nets
Object-oriented specification Class extraction, various diagram to present the class
relationships
![Page 3: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/3.jpg)
Design with formal specification
Example give a Z specification Can you write program codes
for a “push_button” ?
![Page 4: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/4.jpg)
Data and Actions Two aspects of a product
Actions that operate on data Data on which actions operate
The two basic ways of designing a product Operation-oriented design Data-oriented design
Third way Hybrid methods For example, object-oriented design that combines
features of operation-oriented design and data-oriented design
![Page 5: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/5.jpg)
13.1 Design and Abstraction Classical design activities
Architectural design – general and high-level Detailed design Design testing
Architectural design – create modules of the software Input: Specifications document Output: Modular decomposition of the software
Detailed design Each module is designed
Specific algorithms and data structures are selected
![Page 6: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/6.jpg)
13.2 Operation-Oriented Design If system can be presented in a DFD Data flow analysis (DFA)
Can use DFA with most specification methods (Structured Systems Analysis is presented here)
Key point: We have detailed action information from the DFD (ie input to and output from the product)
Figure 13.1
![Page 7: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/7.jpg)
Data Flow Analysis Every product transforms input into output Determine
“Point of highest abstraction of input” “Point of highest abstract of output”
Figure 13.2
![Page 8: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/8.jpg)
Data flow analysis Point of highest abstraction of input – point at
which the input loses the quality of being input and simply becomes internal data operated by the product
Example – input is a membership number the output could be a flag (valid/ not valid) and a discount %
Point of highest abstraction of output – point at which data can be identified as some form of output
Example – an array collecting all information ready to print out
![Page 9: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/9.jpg)
Example
A software to solve circuit related problems
Input: V, I, R, Z etc At point of highest abstraction: a
matrix Output: the unknown V at t = 10ms Other examples based on your own
experiences?
![Page 10: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/10.jpg)
Data Flow Analysis (contd)
Decompose the product into three modules Input, transform, and output
Repeat stepwise until each module performs a single operation: high cohesion Minor modifications may be needed to lower
the coupling Cohesion – degree of interaction within a
module Coupling – degree of interaction between
modules Cohesion - 結合 ; 凝聚 ; 團結力 ; 附著
![Page 11: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/11.jpg)
Cohesion The degree of interaction within a module Seven categories or levels of cohesion (non-linear scale)
Figure 7.4
![Page 12: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/12.jpg)
Coincidental Cohesion A module has coincidental cohesion if it performs multiple,
completely unrelated actions Example modules:
print_next_line, reverse_string_of_characters_comprising_second_parameter, add_7_to_fifth_parameter, convert_fourth_parameter_to_ floating_point
Such modules arise from rules like “Every module will consist of between 35 and 50
statements” so unrelated functions put together in order to fit the size!
![Page 13: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/13.jpg)
Why Is Coincidental Cohesion So Bad?
It degrades maintainability – too many things to consider A module with coincidental cohesion is not reusable – as it is doing
too many things which are difficult to find other programs using all the same features
The problem is easy to fix Break the module into separate modules, each performing one
task
![Page 14: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/14.jpg)
Logical Cohesion
A module has logical cohesion when it performs a series of related actions, one of which is selected by the calling module
![Page 15: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/15.jpg)
Logical Cohesion (contd) Example 1:
function_code = 7;
new_operation (op code, dummy_1, dummy_2, dummy_3);
// dummy_1, dummy_2, and dummy_3 are dummy variables,// not used if function code is equal to 7
Example 2: An object performing all input and output
Example 3: A module that edits insertions, deletions, and modifications of
master file records
![Page 16: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/16.jpg)
Why Is Logical Cohesion So Bad?
The interface is difficult to understand as there may be many irrelevant information (such as dummy variables)
Code for more than one action may be intertwined Difficult to reuse
![Page 17: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/17.jpg)
Why Is Logical Cohesion So Bad? (contd)
A new tape unit is installed then the new codes will be added that may be inter-twined with the part related to another printer such as section numbered 1,2,3,4,6,9,10
Figure 7.5
![Page 18: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/18.jpg)
Temporal Cohesion A module has temporal cohesion when it
performs a series of actions related in time Example:
open_old_master_file, new_master_file, transaction_file, and print_file; initialize_sales_district_table, read_first_transaction_record, read_first_old_master_record (a.k.a. perform_initialization)
![Page 19: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/19.jpg)
Why Is Temporal Cohesion So Bad?
The actions of this module are weakly related to one another, but strongly related to actions in other modules Consider sales_district_table is being initialized in that module but changing the table is via a different module
When changing a data it will involve many modules some of which may be overlooked
Not reusable – same reason no other software will need all the functions
![Page 20: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/20.jpg)
Procedural Cohesion
A module has procedural cohesion if it performs a series of actions related by the procedure to be followed by the product
Example: read_part_number_and_update_repair_record_on_ master_file
![Page 21: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/21.jpg)
Why Is Procedural Cohesion So Bad? The actions are still weakly connected,
so the module is not reusable
![Page 22: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/22.jpg)
Communicational Cohesion
A module has communicational cohesion if it performs a series of actions related by the procedure to be followed by the product, but in addition all the actions operate on the same data
Example 1:update_record_in_database_and_write_it_to_audit_trail
Both working with record Example 2:
calculate_new_coordinates_and_send_them_to_terminal
Both working with coordinates
![Page 23: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/23.jpg)
Why Is Communicational Cohesion So Bad?
Still lack of reusability
![Page 24: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/24.jpg)
Functional Cohesion
A module with functional cohesion performs exactly one action
![Page 25: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/25.jpg)
7.2.6 Functional Cohesion
Example 1: get_temperature_of_furnace
Example 2: compute_orbital_of_electron
Example 3: write_to_diskette
Example 4: calculate_sales_commission
![Page 26: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/26.jpg)
Why Is Functional Cohesion So Good? More reusable
Common functions can be reused easily Corrective maintenance is easier
Fault isolation – easy to focus Fewer regression faults
Easier to extend a product – add more functions
![Page 27: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/27.jpg)
Informational Cohesion
A module has informational cohesion if it performs a number of actions, each with its own entry point, with independent code for each action, all performed on the same data structure
![Page 28: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/28.jpg)
Why Is Informational Cohesion So Good?
Essentially, this is an abstract data type (see later)
![Page 29: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/29.jpg)
Cohesion Example
Figure 7.7
![Page 30: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/30.jpg)
Example
When two or more different levels of cohesion can be assigned to a module is to assign the lowest possible level
![Page 31: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/31.jpg)
Figure 7.8
Coupling The degree of interaction between two modules
Five categories or levels of coupling (non-linear scale)
![Page 32: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/32.jpg)
Content Coupling Two modules are content coupled if one directly
references contents of the other Example 1:
Module p modifies a statement of module q Example 2:
Module p refers to local data of module q in terms of some numerical displacement within q
Example 3: Module p branches into a local label of module q
![Page 33: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/33.jpg)
Why Is Content Coupling So Bad?
Almost any change to module q, even recompiling q with a new compiler or assembler, requires a change to module p
Difficult to reuse only module p
![Page 34: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/34.jpg)
Common Coupling Two modules are common coupled if they have write
access to global data
Example 1 Modules cca and ccb can access and change the
value of global_variable
Figure 7.9
![Page 35: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/35.jpg)
Common Coupling Example 2:
Modules cca and ccb both have access to the same database, and can both read and write the same record
Example 3: FORTRAN common COBOL common (nonstandard) COBOL-80 global
![Page 36: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/36.jpg)
Why Is Common Coupling So Bad? It contradicts the spirit of structured programming
The resulting code is virtually unreadable What causes this loop to terminate if global_variable is a global variable As its value can be changed with many possibilities
Figure 7.10
![Page 37: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/37.jpg)
Why Is Common Coupling So Bad? (contd)
Modules can have side-effects This affects their readability Example: edit_this_transaction (record_7) The entire module source must be read to find out
what it does because other global variables (not just record_7) may be changed by the function
A change during maintenance to the declaration of a global variable in one module necessitates corresponding changes in other modules
Common-coupled modules are difficult to reuse because global variables are missing in the new software system
![Page 38: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/38.jpg)
Why Is Common Coupling So Bad? (contd)
Common coupling between a module p and the rest of the product can change without changing p in any way
For example, if both module p and q can modify global variable gv then there is one instance of common coupling between p and the other modules. But if 10 new modules are designed and implemented, all of which can modify global variable gv, then the number of instances of common coupling between module p and the other modules increases to 11
A module is exposed to more data than necessary This can lead to computer crime as control of data
access is reduced
![Page 39: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/39.jpg)
Control Coupling Two modules are control coupled if
one passes an element of control to the other
Example 1: An operation code is passed to a
module with logical cohesion Example 2:
A control switch passed as an argument
![Page 40: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/40.jpg)
Control Coupling (contd) Module p calls module q
Message: I have failed (a flag) — data
Message: I have failed, so write error message ABC123
— control The return by q is controlling the
action of p (ie to display the corresponding error message)
![Page 41: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/41.jpg)
Why Is Control Coupling So Bad?
The modules are not independent Module q (the called module) must know the
internal structure and logic of module p otherwise cannot pass back the proper control
This affects reusability Modules are usually logical cohesion
![Page 42: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/42.jpg)
7.3.4 Stamp Coupling Some languages allow only simple
variables as parameters part_number satellite_altitude degree_of_multiprogramming
Many languages also support the passing of data structures
part_record satellite_coordinates segment_table
![Page 43: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/43.jpg)
Stamp Coupling (contd)
Two modules are stamp coupled if a data structure is passed as a parameter, but the called module operates on some but not all of the individual components of the data structure
![Page 44: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/44.jpg)
Why Is Stamp Coupling So Bad?
It is not clear, without reading the entire module, which fields of a record (employee_record) are accessed or changed
Examplecalculate_withholding (employee_record)
Difficult to understand Unlikely to be reusable More data than necessary is passed
Uncontrolled data access can lead to computer crime
![Page 45: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/45.jpg)
Why Is Stamp Coupling So Bad? (contd)
However, there is nothing wrong with passing a data structure as a parameter, provided that all the components of the data structure are accessed and/or changed
Examples:invert_matrix (original_matrix, inverted_matrix);
print_inventory_record (warehouse_record);
![Page 46: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/46.jpg)
7.3.5 Data Coupling
Two modules are data coupled if all parameters are homogeneous data items (simple parameters, or data structures all of whose elements are used by called module)
Examples: display_time_of_arrival (flight_number); compute_product (first_number, second_number); get_job_with_highest_priority (job_queue);
![Page 47: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/47.jpg)
Why Is Data Coupling So Good?
The difficulties of content, common, control, and stamp coupling are not present
Maintenance is easier because a change in one module is less likely to cause a regression fault in the other
![Page 48: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/48.jpg)
Coupling Example
Figure 7.11
The number in the linkis the interfaceP calls q with interface (1)
![Page 49: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/49.jpg)
Coupling Example (contd)
Interface description
Figure 7.12
![Page 50: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/50.jpg)
Coupling Example (contd)
Coupling between all pairs of modules
Figure 7.13
![Page 51: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/51.jpg)
Mini Case Study: Word Counting
Example:
Design a product which takes as input a file name, and returns the number of words in that file (like UNIX wc )
Figure 13.3
From programming point of view A file pointer is used to present the file
![Page 52: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/52.jpg)
Mini Case Study: Word Counting (contd)
First refinement – represented using structured diagram
Now refine the two modules of communicational
cohesion Read_and_validate_file_name shows a communicational cohesion-it performs a series of operationsrelated by the sequence of steps
![Page 53: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/53.jpg)
Structure diagram
In the structured diagram (SD), each node represent a module.
A module is a functional abstraction to be implemented by a software module
Usually assume a modules are called by a master module (transaction flow centered)
SD is derived from the DFD
![Page 54: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/54.jpg)
Second refinement
All eight modules now have functional cohesion
Mini Case Study: Word Counting (contd)
Figure 13.5
![Page 55: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/55.jpg)
Word Counting: Detailed Design
The architectural design is complete So proceed to the detailed design Data structures are chosen Algorithms selected
The detailed design is handed to a programmer for implementation
Two formats for representing the detailed design: Tabular Pseudocode (PDL — program design language) PDL is usually used if the programming language is
chosen
![Page 56: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/56.jpg)
Detailed Design: Tabular Format
Figure 13.6(a)
![Page 57: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/57.jpg)
Detailed Design: Tabular Format (contd)
Figure 13.6(b)
![Page 58: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/58.jpg)
Detailed Design: Tabular Format (contd)
Figure 13.6(c)
![Page 59: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/59.jpg)
Detailed Design: Tabular Format (contd)
Figure 13.6(d)
![Page 60: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/60.jpg)
Detailed Design: PDL Format
Figure 13.7
![Page 61: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/61.jpg)
13.3.2 Data Flow Analysis Extensions
In real-world products, there is More than one input stream, and More than one output stream
![Page 62: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/62.jpg)
Data Flow Analysis Extensions
Find the point of highest abstraction for each stream Continue until each module has high cohesion
Adjust the coupling if needed
Figure 13.8
![Page 63: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/63.jpg)
Exercise
Based on the DFD of the library system, design the circulation system using data flow analysis Draw the structured diagram (2
iterations) Detailed design of
“obtained_catalog_information” PDL for “check_out_book”
![Page 64: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/64.jpg)
Exercise
Convert the above Z specification into a PDL
![Page 65: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/65.jpg)
Data-Oriented Design Basic principle
Design the product according to the structure of the data on which it is to operate
Each procedure is given the same structure as the data on which it operates
Three very similar methods Michael Jackson [1975], Warnier [1976], Orr [1981]
Data-oriented design Has never been as popular as action-oriented design With the rise of OOD, data-oriented design has
largely fallen out of fashion
![Page 66: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/66.jpg)
13.6 Object-Oriented Design (OOD) Aim
Design the product in terms of the classes extracted during OOA
If we are using a language without inheritance (e.g., C, Ada 83)
Use abstract data type design
If we are using a language without a type statement (e.g., FORTRAN, COBOL)
Use data encapsulation
![Page 67: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/67.jpg)
Object-Oriented Design Steps OOD consists of two steps:
Step 1. Complete the class diagram Determine the formats of the attributes Assign each method, either to a class or to a client that sends a
message to an object of that class
Step 2. Perform the detailed design
![Page 68: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/68.jpg)
Object-Oriented Design Steps (contd) Step 1. Complete the class diagram
The formats of the attributes can be directly deduced from the analysis artifacts
Example of deriving an attribute: Dates U.S. format (mm/mm/yyyy) European format (dd/mm/yyyy) In both instances, 10 characters are needed
![Page 69: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/69.jpg)
Object-Oriented Design Steps (contd)
Step 1. Complete the class diagram Assign each method, either to a class or to a client
that sends a message to an object of that class Principle A: Information hiding Principle B: If an operation is invoked by many
clients of an object, assign the method to the object, not the clients
Principle C: Responsibility-driven design (class receiving the request is responsible to carry out the operation)
![Page 70: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/70.jpg)
Information hiding
An object is a collection of data and function so entities outside an object does not know what is inside (information is hidden from the outside world!!!)
![Page 71: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/71.jpg)
13.7 Object-Oriented Design: The Elevator Problem Case Study
Step 1. Complete the class diagram
Need to identify methods (functions) of a class Consider the second iteration of the CRC card for the
elevator controller
![Page 72: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/72.jpg)
OOD: Elevator Problem Case Study
CRC card
Figure 12.9 (again)
![Page 73: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/73.jpg)
OOD: Elevator Problem Case Study (contd)
Responsibilities 8. Start timer 10. Check requests, and 11. Update requests
are assigned to the elevator controller
Because they are carried out by the elevator controller – according to responsibility-driven design
![Page 74: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/74.jpg)
OOD: Elevator Problem Case Study (contd)
The remaining eight responsibilities have the form “Send a message to another class to tell it do
something”
These should be assigned to that other class Responsibility-driven design Safety considerations
Methods open doors, close doors are assigned to class Elevator Doors Class
Methods turn off button, turn on button are assigned to classes Floor Button Class and Elevator Problem Class
![Page 75: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/75.jpg)
Figure 13.11
Detailed Class Diagram: Elevator Problem
![Page 76: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/76.jpg)
Detailed Design: Elevator Problem
Detailed design of elevatorEventLoop
is constructed from the statechart
Figure 13.12
![Page 77: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/77.jpg)
Dynamic Modeling: The Elevator Problem Case Study
Produce a UML statechart
State, event, and predicate are distributed over the statechart
Figure 12.7
![Page 78: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/78.jpg)
13.8 Object-Oriented Design: The MSG Foundation Case Study
Step 1. Complete the class diagram
The final class diagram is shown in the next slide Date Class is needed for C++ Java has built-it functions for handling dates
![Page 79: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/79.jpg)
Final Class Diagram: MSG Foundation
Figure 13.13
![Page 80: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/80.jpg)
Class Diagram with Attributes: MSG Foundation
Figure 13.14
![Page 81: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/81.jpg)
Assigning Methods to Classes: MSG Foundation
Example: setAssetNumber, getAssetNumber From the inheritance tree, these
accessor/mutator methods should be assigned to Asset Class
So that they can be inherited by both subclasses of Asset Class (Investment Class and Mortgage Class)
Figure 13.15
![Page 82: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/82.jpg)
Assigning Methods to Classes: MSG Foundation
![Page 83: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/83.jpg)
Detailed Design: MSG Foundation
Determine what each method does
Represent the detailed design in an appropriate format PDL (pseudocode) here
![Page 84: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/84.jpg)
Method EstimateFundsForWeek::computeEstimatedFunds
Figure 13.16
![Page 85: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/85.jpg)
Method Mortgage::totalWeeklyNetPayments
Figure 13.17
![Page 86: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/86.jpg)
13.9 The Design Workflow Summary of the design workflow:
The analysis workflow documents (input for design workflow) are iterated and integrated until the programmers can utilize them
Major tasks to achieve – identify the methods to be assigned to classes as well as performing detailed design
Decisions to be made include: What programming language to use Reuse of existing software components Portability – work under different software/hardware
platform
![Page 87: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/87.jpg)
The Design Workflow (contd) The idea of decomposing a large workflow into
independent smaller workflows (packages) is carried forward to the design workflow
The objective is to break up the upcoming implementation workflow into manageable pieces Subsystems
It does not make sense to break up the MSG Foundation case study into subsystems — it is too small
![Page 88: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/88.jpg)
The Design Workflow (contd)
Why the product is broken into subsystems: It is easier to implement a number of
smaller subsystems than one large system
If the subsystems are independent, they can be implemented by programming teams working in parallel
The software product as a whole can then be delivered sooner
![Page 89: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/89.jpg)
The Design Workflow (contd)
The architecture of a software product includes The various components How they fit together The allocation of components to subsystems
The task of designing the architecture is specialized It is performed by a software architect
![Page 90: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/90.jpg)
The Design Workflow (contd)
The architect needs to make trade-offs Every software product must satisfy its functional
requirements (the use cases) It also must satisfy its nonfunctional requirements,
including Portability, reliability, robustness, maintainability,
and security It must do all these things within budget and time
constraints
The architect must assist the client by laying out the trade-offs – balance between the requirements and the budget
![Page 91: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/91.jpg)
The Design Workflow (contd) It is usually impossible to satisfy all the requirements,
functional and nonfunctional, within the cost and time constraints
Some sort of compromises have to be made The client has to
Relax some of the requirements; Increase the budget; and/or Move the delivery deadline
The software architect must provide expert knowledge to assist the client to make the proper decision !!!!
![Page 92: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/92.jpg)
The Design Workflow (contd)
The architecture of a software product is critical The requirements workflow can be fixed during
the analysis workflow The analysis workflow can be fixed during the
design workflow The design workflow can be fixed during the
implementation workflow But there is no way to recover from a suboptimal
architecture The architecture must immediately be
redesigned
![Page 93: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/93.jpg)
13.10 The Test Workflow: Design
Testing the design Design reviews (testing) must be
performed The design must correctly reflect the
specifications The design itself must be correct
![Page 94: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/94.jpg)
13.11 The Test Workflow: The MSG Foundation Case Study
A design inspection must be performed All aspects of the design must be
checked
Even if no faults are found, the design may be changed during the implementation workflow
![Page 95: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/95.jpg)
13.12 Formal Techniques for Detailed Design
Implementing a complete product and then proving it correct is hard
However, use of formal techniques during detailed design can help
Correctness proving can be applied to module-sized pieces The design should have fewer faults if it is developed in
parallel with a correctness proof If the same programmer does the detailed design and
implementation The programmer will have a positive attitude to the
detailed design This should lead to fewer faults
![Page 96: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/96.jpg)
13.15 Metrics for Design Measures of design quality
Cohesion Coupling Fault statistics
Cyclomatic complexity (M) – counting the number of binary decisions (branches) plus 1; the lower the value of M, the better
CC = 1 if no decision is made Cyclomatic complexity is problematic
Data complexity is ignored (the value M is related to the control complexity)
It is not used much with the object-oriented paradigm
![Page 97: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/97.jpg)
Cyclomatic Complexity
What is the cyclomaticcomplexity for the flow graph?
![Page 98: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/98.jpg)
Metrics for Design (contd)
Metrics have been put forward for the object-oriented paradigm They have been challenged on both
theoretical and experimental grounds There is no suitable metric for OOD
![Page 99: DESIGN. Quick Summary What you have learnt so far? Different kinds of software engineering methodology Waterfall model Spiral model Unified process Requirements](https://reader030.vdocuments.net/reader030/viewer/2022032605/56649e855503460f94b880c3/html5/thumbnails/99.jpg)
13.16 Challenges of the Design Phase The design team should not do too much
The detailed design should not become code The design team should not do too little
It is essential for the design team to produce a complete detailed design