Detailed DesignAfter high-level design…Slide 3Danger, Will Robinson!PDL: Process Design LanguageOn the Web…PDL constructsPDL constructs, continuedExampleDiscussionAnother example (taken from IBM paper)Slide 12Truth in Advertising?VerificationMetricsCyclomatic ComplexityData BindingsCohesion Metric (1 of 3)Cohesion Metric (2 of 3)Cohesion Metric (3 of 3)SummaryDetailed DesignKenneth M. AndersonLecture 21CSCI 5828: Foundations of Software EngineeringAfter high-level design…Once high-level design is done, you havea graphical representation of the structure of your software systema document that defines high-level details of each module in your system, includinga module’s interface (including input and output data types)notes on possible algorithms or data structures the module can use to meet its responsibilitiesa list of any non-functional requirements that might impact the moduleWhat’s next?Detailed DesignAfter high-level design, a designer’s focus shifts to low-level designEach module’s responsibilities should be specified as precisely as possibleConstraints on the use of its interface should be specifiedpre and post conditions can be identifiedmodule-wide invariants can be specifiedinternal data structures and algorithms can be suggestedDanger, Will Robinson!A designer must exhibit caution, however, to not over specify a designas a result, we do not want to express a module’s detailed design using a programming languageyou would naturally end up implementing the module perhaps unnecessarily constraining the approaches a developer would use to accomplish the same job nor do we (necessarily) want to use only natural language text to specify a module’s detailed designnatural language text slips too easily towards ambiguityPDL: Process Design LanguageOne solution to this problem is to apply “structure” to natural language descriptionsavoids the detail of a programming languagewhile limiting ambiguityPDL is one such language developed for detailed designNote: UML diagrams can also be used as a detailed design languageState diagrams and interaction diagrams can be used to indicate the behavior of an object at a high levelOn the Web…I could not find an article on the Web that described the “process design language” that Jalote describesI 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 McConnellPDL constructsSimilar to programming languages, PDL provides a number of constructsAnything not capitalized below can be replaced with natural language text or other PDL constructsIF constructIF condition THENstatementsELSEstatementsENDIFPDL constructs, continuedCASE constructCASE variable OFvalue1: statements…valueN: statementsENDCASELOOP constructDO conditionstatementsENDDOExampleminmax(input)ARRAY aDO UNTIL end of inputREAD an item into aENDDOmax, min := first item of aDO FOR each item in aIF max < item THEN set max to itemIF min > item THEN set min to itemENDDOENDDiscussionPDL has a pseudocode feelThis particular example is poorWhy?Any advantages?Another example (taken from IBM paper)Accumulate total sales for all districtsAccumulate total sales for each districtAccumulate total sales for each salesmanPrint total sales for each salesmanPrint total sales for each districtSkip to new page after printing district totalPrint total sales for all districtsDiscussionLevel of abstraction is at higher levelwhile still providing a direction for how this module will meet its requirementsIf 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 waysOther issues?Truth in Advertising?I found the following statement on the Web concerning PDL:<http://www.cacs.louisiana.edu/~mgr/404/burks/foldoc/37/93.htm>“Program Design Language: Any of a large class of formal and profoundly useless pseudo-languages in which management forces one to design programs. Too often, management expects PDL descriptions to be maintained in parallel with the code, imposing massive overhead of little or no benefit.See also flow chart.”VerificationIf a structured notation is used, such as UML, some tools may be able to perform consistency analysis on design specificationsfor example, are the events referenced in a sequence diagram defined as methods on the objects shown in the sequence diagramOtherwise:design walkthroughs: walk through the logic of a designcritical design review: does the detailed design match the high-level designboth are performed by developers as part of the inspection process of a software development projectMetricsCyclomatic ComplexityData BindingsCohesion MetricCyclomatic ComplexityA complexity metric with a simple ideaGiven two programs of the same size, the program with the larger number of decision statements is likely more complexIndeed, the cyclomatic complexity of a module is defined to be the number of decisions in a module plus 1McCabe (the metric’s inventor) proposed that the cyclomatic complexity of a module should be less than 10This 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 moduleData BindingsA metric to capture the strength of coupling between modules in a software systempotential data binding: (p, x, q)module p and q have a shared variable xused data binding: (p, x, q)module p and q both assign or reference variable xactual data binding: (p, x, q)module p assigns to x, q reads from xThe higher the value, the stronger the connection between p and qCohesion Metric (1 of 3)A metric to quantify the cohesion of a moduleThe basic idea is to see how the variables of a module are being used by the code of that moduleConstruct a control flow graph for the moduleI is the start node of the graphT is the end node of the graphEach node is annotated with the variables it referencesUse this graph to compute a reference set for each variable: Ri = set of
View Full Document