Chapter 12 Analysis Modelling Analysis Modelling : Where to Begin? o the FAST working document provides a “statement of scope” for the software o the working document must be “parsed” to extract data and function domain information 1 Building the Analysis Model o odata data model model ï ï data dataobjects objects ï ïrelationships relationships ï ï ERDs ERDs o ofunctional functional model model ï ï data datatransforms transforms ï ïDFDs DFDs o obehavioural behavioural model model ï ïevents eventsand andstates states ï STDs ï STDs The Structure of the Model Data Dictionary State-Transition Diagram 2 The Data Model o A data object is a representation of almost any composite information that must be understood by software o Attributes define the properties of a data object and take on one of three different characteristics o Relationships connect data objects to one another in a variety of different ways The ERD : Relationships orders displays Book stocks sells returns Bookstore Relationships between objects 3 The ERD : Cardinality & Modality Cardinality and modality The Functional Model : The DFD data/control flow notation process external entity data item event flow, control item data/control store 4 Data Flow Hierarchy Flow Modelling Notes o all arrows, with the possible exception of arrows to/from stores should be labelled o information or control continuity (sometimes called “balancing”) is maintained between levels of the flow model o a suggested “expansion ratio” between one level and the next is 1:5 o if a bubble does a number of different things, it needs further refinement o the flow model itself is not enough, other notation must be developed for a complete description of requirements 5 Getting Started Example Manufacturing cell software controls a robot by generation of position coordinates that are transmitted to the robot. An operator inputs commands that cause the manufacturing cell software to read positioning and control commands from an NC command file. Components to be assembled are held in parts fixtures that activate robot control functions once each fixture contains a part ... Getting Started (Cont’d) Using nouns to isolate external entities, data items and stores Manufacturing cell software controls a robot by generation of position coordinates that are transmitted to the robot. An operator inputs commands that cause the manufacturing cell software to read positioning and control commands from an NC command file. Components to be assembled are held in parts fixtures that activate robot control functions once each fixture contains a part ... Use verbs to help isolate processes (bubbles) 6 Creating a Context Diagram Level 0 Flow Model (also called a “context diagram” DFD Questions Q : How does the NC unit software transform input to output? A : Lower DFD levels will provide details. Q : What are “operator commands”? A : Another notational tool- the data dictionary- will help to describe. Q : Where are processing details? A : A PSPEC (“structured English”) and other notational tools are used. 7 Refining to Level 1 Refining to Model More Detail 8 Flow Modelling : Q & A Q : How far do we take the flow model ... What should a bubble represent? A : For now, we’ll say that each bubble should correspond to an independent software module. Later we’ll define more explicit terms. Q : How do we know what goes on inside a bubble? A : Lower level flow models provide part of the answer, a processing narrative provides the rest. Flow Modelling : Q & A (Cont’d) Q : What does a value on an arrow really mean? A : The data dictionary provides a detailed description of a composite data item. Q : Aren’t there a number of different ways to draw the flow model? A : Yes, just as there are different ways to write an English language description or code the program. 9 Process & Control Models Process Model Data Conditions 10 The Control Model o the control flow diagram is “superimposed” on the DFD and shows events that control the processes noted in the DFD o control flows- events and control items- are noted by dashed arrows o a vertical bar implies an input to or output from a control spec (CSPEC)- a separate specification that describes how control is handled The Control Model (Cont’d) o a dashed arrow entering a vertical bar is an input to the CSPEC o a dashed arrow leaving a process implies a data condition o a dashed arrow entering a process implies a control input read directly by the process o control flows do not physically activate/deactivate the processes- this is done via the CSPEC 11 Level 1 DFD for Photocopier Level 1 CFD for photocopier 12 Control Flow Diagram Control Specification (CSPEC) 13 State-transition for photocopier Guidelines for Building a CSPEC o list all sensors that are “read” by the software o list all interrupt conditions o list all “switches” that are actuated by the operator o list all data conditions o recalling the noun-verb parse that was applied to the software statement of scope, review all “control items” as possible CSPEC inputs/outputs o describe the behaviour of a system by identifying its states; identify how each state is reach and defines the transitions between states o focus on possible omissions ... A very common error in specifying control, e.g., ask : “Is there any other way I can get to this state or exit from it?” 14 Process Specification (PSPEC) Processing Narrative 15 Using PDL The Data Dictionary o o aa quasi-formal quasi-formal grammar grammar for for describing describing the the content content of of data data that that the the software software will will process process and and create create o o aa notation notation for for describing describing control control data data and and the the values values that that control control data data can can take, take, e.g., e.g., “on” “on” or or “off” “off” o o aa repository repository that that also also contains contains “where-used” “where-used”//“how “how used” information used” information o o aa notation notation that that can can be be represented represented manually, manually, but but isis best bestdeveloped developedusing usingCASE CASEtools tools 16 Building a Data Dictionary Name : Aliases: Where used: How used: Description: Format: the primary name of the composite data item other names for the data item data transforms (processes) that use the composite data item the role of the data item (input, output, temporary storage, etc. a notation for representing content (presented on next slide) specific information about data types, pre-set values (if known) Data Dictionary Notation Notation Meaning = is composed of + and [|] either-or { }n n repetitions of ( ... ) optional data * ... text ... * delimits a comment 17 Data Dictionary Example Writing the Software Specification 18 Specification Guidelines o use a layered format that provides increasing detail as the “layers” deepen o use consistent graphical notation and apply textual terms consistently (stay away from aliases) o be sure to define all acronyms o be sure to include a table of contents; ideally, include an index and/or a glossary o write in a simple, unambiguous style (see “editing suggestions” on the following pages) o always put yourself in the reader’s position, “Would I able to understand this if I wasn’t intimately familiar with the system?” Specification Guidelines Be on the lookout for persuasive connectors, ask why? Keys : certainly, therefore, clearly, obviously, it follows that ... Watch out for vague terms keys : some, sometimes, often, usually, ordinarily, most, mostly ... When lists are given, but not completed, be sure all items are understood keys : etc., and so forth, and so on, such as 19 Specification Guidelines (Cont’d) Be sure stated ranges don’t contain unstated assumptions e.g., Valid codes range from 10 to 100. Integer? Real? Hex? Beware of vague verbs such as handled, rejected, processed, ... Beware “passive voice” statements e.g., The parameters are initialized. By what? Beware “dangling” pronouns e.g., The I/O module communicated with the data validation module and its control flag is set. Whose control flag? Specification Guidelines When a term is explicitly defined in one place, try substituting the definition for other occurrences of the term When a structure is described with a picture, try to redraw the picture to emphasize different elements of the structure When symbolic equations are used, try expressing their meaning in words When a calculation is specified, work at least two examples Look for statements that imply certainty, then ask for proof keys; always, every, all, none, never Search behind certainty statements- be sure restrictions or limitations are realistic 20 Example: SafeHome Establishing Connection 21 Developing relationship Level 0 DFD for SafeHome 22 Level 1 DFD Level 2 DFD – monitor sensor 23 Level 1 CFD for SafeHome State-Transition Diagram 24 Process activation table 25