Illinois Institute of Technology CS487 Software Engineering Requirements II- part B Instructor David Lash CS48704-1/47 Example of Modality and Cardinality Cardinality: A single customer has order(s) Customer Cardinality: Multiple orders for a customer. 1 Modality: An order must have a customer CS48704-2/47 has M Orders Modality: A customer does not require an order Example of ERD CS48704-3/47 Creating ERDs Take each “things” (e.g., car, contact list) mentioned in requirements and ask about relationships to other things Object-relationship pairs and therefore identified – Explore the carinality and modality of that relationship Repeat for each object identified Review the objects and establish attributes Form the ERD and review CS48704-4/47 ERD II example - Homesafe Enables homeowner (HW) to config security system (SS), during install HS monitors all sensors connected to SS HS interacts with HW via Keypad on cntl panel (CP) CP is used to program system Each sensor (SEN) is assigned a # and type A master passwd is programmed, Tel number are input for dialing on Sensor event (SEN) on SEN event, alarm invoked & SS dials phone number, and gives info to (MS) monitoring Service CP has keyboard input stuff CS48704-5/47 ERD II example - Homesafe Control Panel HomeOwner Monitoring Service Security System Sensor CS48704-6/47 ERD II example - Derived Relationships SS monitors sensor SS enables/disables sensor SS tests sensor SS program sensor Attributes of Sensor has type, internal id, zone location, alarm level CS48704-7/47 ERD II example - Homesafe programs Sensor needs security system Security System Security System needs sensor. Enables/ disables Sensor Sensor controled from Security system controls 1 single security system or more sensors monitors CS48704-8/47 High-Level Modeling Tools System Modeling – – Data Modeling – Entity-Relation - Data objects and their relationships Information flow diagrams – System Context Diagram Partitioning Data flow diagrams - how data transforms in system- how functions transform data Control Specifications – CS48704-9/47 State diagrams - how system behaves as result of external events . Data Flow Diagrams ( Information Flow ) A graphical technique that depicts information flow and the transforms that are applied as data moves from input to output. – Input can be sensor, human operator, web page input, hardware – Transformation can be logical comparison, numerical algorithm, graphic algorithm, – Output can be LED, web page, report, effect on hardware CS48704-10/47 Data Flow Diagram (Divide Operation) dividend quotient integer division remainder divisor Level 0 DF (fundamental) diagram represents system with 1 bubble CS48704-11/47 Data Flow Diagram (Symbols) Process (Data Transformation) External Entity (I/O Src/Dest) External Data Store (all or part of the information store) Thing System External Thing CS48704-12/47 External Thing Data Flow Diagram (Data Flows or Connectors) street address city address state ZIP Code number CS48704-13/47 Level 0 Data Flow External Entity 1 an Tr Inp ut D ata System External Entity CS48704-14/47 ta a ut D Inp Input Data Output data Ou tpu tD ata External Entity External Entity External Entity Level 0 Data Flow CS48704-15/47 Level 0 Data Flow (Interactive System) A generalization of users External Entity CS48704-16/47 Manual Input System Generated Output Data Flow Diagram (Divide Operation) CS48704-17/47 Level 1 - Data Flow (Major Process Operators) Extern IN1 In Stru 1 Process 1 In Stru 1-A Data Stru 1 DATA STORE Data Stru 1 Proces4 Process 2 Rpt Stru 2 External OUT2 Tran 1 Data Stru 1 Process3 External IN2 CS48704-18/47 In Stru 2 External OUT1 Guidelines for building a Data Flow Diagram 1. Show the first level (level 0) as a single process with all of its external inputs and outputs sources. 2. Primary input and output should be carefully noted. 3. Refinement begins by isolating candidate processes. 4. All data flows and symbols should be labeled with meaningful names. 5. Information flow continuity must be maintained. (within the refinement) 6. One bubble at a time is expanded. 7. Record all components in the data dictionary. CS48704-19/47 Level N Data Flow (Detailed Process to Transform) Fill in Data IN Stru 1 Complete missing data Process 3c Process 3b IN Stru 1 Complete IN Stru 1 missing data IN Stru 1 CS48704-20/47 Stru Data Process 3a DATA Store Data-Flow Example R.S. Pressman, Ph.D. Software Engineering: A Practitioner’s Approach. McGraw-Hill, New York, New York. 1997. p. 377 CS48704-21/47 Level 1 - introduce process and data store R.S. Pressman, Ph.D. Software Engineering: A Practitioner’s Approach. McGraw-Hill, New York, New York. 1997. p. 378 CS48704-22/47 Level 2 - Show more detail for each level 1 process (monitor sensors) R.S. Pressman, Ph.D. Software Engineering: A Practitioner’s Approach. McGraw-Hill, New York, New York. 1997. p. 379 CS48704-23/47 Behavioral Modeling Behavior is the observable effects of an event, including its results. Control flow diagramming – An extension to data flow diagramming – Adds events to the data model State transition diagrams – More traditional behavior model. – Useful for a variety of applications. CS48704-24/47 State Diagram A state diagram illustrates how the system moves from state to state. For example – – monitoring state -> alarm state -> monitoring state (homesafe) What events trigger the change in state? Sense danger, reset alarm A state diagram shows the state machine – State Machine A behavior that specifies the sequences of states an object goes through during its lifetime in response to events, together with its responses to those events CS48704-25/47 What is the scientific base for state-machine? Conservation of Momentum Law When the resultant external force acting on a system is zero, the total momentum of the system remains constant. CS48704-26/47 What are the components of a state machine? States – – – Any observable mode of behavior. A condition or situation during the life of an object during which it satisfies some condition, performs some activity or waits for some event. Description is contained in a data dictionary. Name CS48704-27/47 What are the components of a state machine? Transitions – A relationship between two states indicating that an object in the first state will perform certain actions and enter the second state when a specified event occurs and specified conditions are satisfied. (Event & Conditions) CS48704-28/47 Types of state transition diagrams Action on transition – – – Actions are performed on event transition On the diagram that is where the actions are defined. Events, Conditions and Actions are described in the data dictionary. (Event & Conditions): Action(s) CS48704-29/47 Example of action on transition State 2 (B1 & NOT T1): No action. (B1 & T1): Invoke state2 B2: Invoke state0 State 0 B2: Invoke state 1 State 1 T1: Set Time to nn States: State 0: Normally idle State 1: Processing State 2: The blue screen of death CS48704-30/47 Events: T1 - Time 1 B1 - Button 1 B2 - Button 2 Types of state-transition diagrams. Action on state entry – – – Actions are performed when a state is entered. Transitions carry optional data and not actions. States, events, conditions and data are described in the data dictionary. (Event & Condition): Data CS48704-31/47 State Name Action(s) Parser Example Given a text (stored on a file) consisting of words separated by SPACE characters or by CR (new line) characters, a program is supposed to read the text and suppress all extra SPACE characters according to the following rules: – Words should be separated only by one SPACE character, – Between a word and CR character there should be no SPACE character, – New line cannot start with a SPACE character, – Program terminates on EOF (End of File) character. CS48704-32/47 Example Processing States – New Line. Last character was a CR or beginning of process. – Word. Last character is not a space or CR. – Space. Last character is a space. – End-of-file. CS48704-33/47 Example Events (must be account for in each state) – End-of-file indicator – NL Character – Space Character – Text Characters CS48704-34/47 Example Actions – Read Next – Store Word – Set Error – List Stored Words CS48704-35/47 State Diagram Example SP: Read Next, Set Error Read Next CR: Read Next New Line CR: Read Next Store Word SP: Read Next Store Word SP: Read Next, Set Error Space Char: Read Next CR: Read Next Char: Read Next Word EOF: List Stored Words EOF: List Stored Words EOF: List Stored Words EOF CS48704-36/47 Analysis Modeling Software models must represent: – the information that the sftwr acts on – the function that enable action – and overall system behavior Requirements Models Roles: – Understand the information, function, behavior and information in the system – Focal Point for the review - Avoids lots of wrds help deal with complexity of problem – Become foundation for design process CS48704-37/47 High-Level Modeling Tools System Modeling – – Data Modeling – Entity-Relation - Data objects and their relationships Information flow diagrams – System Context Diagram Partitioning Data flow diagrams - how data transforms in system- how functions transform data Control Specifications – State diagrams - how system behaves as result of external events. CS48704-38/47