Download Lecture Slides on Detailed Design - Foundations of Software Engineering | CSCI 5828 and more Study notes Software Engineering in PDF only on Docsity! Detailed Design Kenneth M. Anderson Lecture 21 CSCI 5828: Foundations of Software Engineering After high-level design… Once high-level design is done, you have a graphical representation of the structure of your software system a document that defines high-level details of each module in your system, including a module’s interface (including input and output data types) notes on possible algorithms or data structures the module can use to meet its responsibilities a list of any non-functional requirements that might impact the module What’s next? PDL: Process Design Language One solution to this problem is to apply “structure” to natural language descriptions avoids the detail of a programming language while limiting ambiguity PDL is one such language developed for detailed design Note: UML diagrams can also be used as a detailed design language State diagrams and interaction diagrams can be used to indicate the behavior of an object at a high level On the Web… I could not find an article on the Web that described the “process design language” that Jalote describes I did find an article on IBM’s website about something similar called “program design language” If you are curious, take a look at <http://www.research.ibm.com/journal/sj/152/ibmsj1502E.pdf> I will be using the syntax that is described in that document (which is slightly different than what appears in our textbook) Program Design Language is also discussed in the book Code Complete by Steve McConnell PDL constructs Similar to programming languages, PDL provides a number of constructs Anything not capitalized below can be replaced with natural language text or other PDL constructs IF construct IF condition THEN statements ELSE statements ENDIF Discussion PDL has a pseudocode feel This particular example is poor Why? Any advantages? Another example (taken from IBM paper) Accumulate total sales for all districts Accumulate total sales for each district Accumulate total sales for each salesman Print total sales for each salesman Print total sales for each district Skip to new page after printing district total Print total sales for all districts Discussion Level of abstraction is at higher level while still providing a direction for how this module will meet its requirements If you leave out the “skip to new page” statement and the use of the word “print”, the specification could be implemented in a number of ways Other issues? Metrics see
e Cyclomatic Complexity
e Data Bindings
e Cohesion Metric
Cyclomatic Complexity A complexity metric with a simple idea Given two programs of the same size, the program with the larger number of decision statements is likely more complex Indeed, the cyclomatic complexity of a module is defined to be the number of decisions in a module plus 1 McCabe (the metric’s inventor) proposed that the cyclomatic complexity of a module should be less than 10 This metric is highly correlated to the size of a module and has been found to be correlated to the number of faults found in a module Data Bindings A metric to capture the strength of coupling between modules in a software system potential data binding: (p, x, q) module p and q have a shared variable x used data binding: (p, x, q) module p and q both assign or reference variable x actual data binding: (p, x, q) module p assigns to x, q reads from x The higher the value, the stronger the connection between p and q Cohesion Metric (3 of 3) The cohesion of a module with n variables is then computed as: The idea is that if a module has high cohesion then most of the variables will be used by statements in most of the paths through that module Summary The design of a software system is split into two phases high-level design a system viewed as a set of modules low-level design providing detailed information about each module What’s next? Chapter 7 of the concurrency textbook Other aspects of design: design patterns, design by convention, etc.