STD -- Development & Testing Procedures - Page L16-1 MEF-OOM&A-L16-1 Dr. M.E. Fayad Lesson 16: STD -- Development & Testing Procedures Object- Oriented Modeling & Applications
STD -- Development & Testing Procedures - Page L16-2 MEF-OOM&A-L16-2 Dr. M.E. Fayad Lesson Objectives oUnderstand STD development procedures oUnderstand some of the common errors that are made in constructing STDs oList and discuss some practical tips about dynamic modeling
STD -- Development & Testing Procedures - Page L16-3 MEF-OOM&A-L16-3 Dr. M.E. Fayad STD Development Procedures Identify external events from the Context Diagrams –A discrete data item arrives –A required time passed –A recognition device signals an event Use scenarios Identify state from DFDs Add Idle state to the list of states
STD -- Development & Testing Procedures - Page L16-4 MEF-OOM&A-L16-4 Dr. M.E. Fayad STD Development Procedures (con’d) Combine states and events into a STD Identify actions that need to be performed after each event Identify states that split into substates Use an action table to check for missing states and events Walkthrough the STD with users to verify it
STD -- Development & Testing Procedures - Page L16-5 MEF-OOM&A-L16-5 Dr. M.E. Fayad Testing a STD Five clues 1. No transition out of a state 2. No transition into a state 3. The STD is too complicated 4. Ambiguous or unclear event names 5. Events with continuous instead of discrete signals
STD -- Development & Testing Procedures - Page L16-6 MEF-OOM&A-L16-6 Dr. M.E. Fayad No Transition Out of a State Clue # 1: No transition out of a state Cause: An event & transition line have been omitted Cure: Identify the event and add the transition Start Stop Idle State Heating Cooling Cold Enable Heat Warm Disable Heat Hot Enable Cooling Start Stop Idle State Heating Cooling Cold Enable Heat Warm Disable Heat Hot Enable Cooling OK Disable Cooling A STD in which the Cooling state has no exit
STD -- Development & Testing Procedures - Page L16-7 MEF-OOM&A-L16-7 Dr. M.E. Fayad No Transition Into a State Clue # 2: No transition into a state Cause: An event & transition line have been omitted Cure: Identify the event and add the transition A STD with no way to get into the Cooling state Start Stop Idle State Heating Cooling Cold Enable Heat Warm Disable Heat Cold Enable Heat Start Stop Idle State Heating Cooling Cold Enable Heat Warm Disable Heat Cold Enable Heat Hot Enable Cool
STD -- Development & Testing Procedures - Page L16-8 MEF-OOM&A-L16-8 Dr. M.E. Fayad The STD is Too Complicated Clue # 3: The STD is too complicated. Cause: The STD should be redrawn in multiple levels Cure: Identify independent group of states and give them a group name Each group can then be redrawn in detail on separate diagrams Such leveling reduces the complexity of the diagrams and make easier for the reader to identify the different processes that are being controlled.
STD -- Development & Testing Procedures - Page L16-9 MEF-OOM&A-L16-9 Dr. M.E. Fayad The STD is Too Complicated (cont’d) Start Stop Idle State Gas Heating Electric Heating Cold Enable Gas Cold Enable Gas Refrigeration Adding Base Adding Acid Cold or Cool Enable Electric Cool Disable Gas OK Disable Electric Hot Enable Refrig’n Cold oe Cool Disable Refrig’n Hot Disable Electric Enable Refrig’n Acid Enable Base OK Disable Base OK Disable Acid Basic Enable Acid
STD -- Development & Testing Procedures - Page L16-10 MEF-OOM&A-L16-10 Dr. M.E. Fayad The STD is Too Complicated (cont’d) Start Stop Idle State Control Temperature Wrong Temperature Enable Control Control pH Temperature OK Disable Control Wrong pH Enable pH Control pH OK Disable pH Control This STD combines two control functions that should be separated and leveled. Control Temperature and Control pH can then be zoomed separately
STD -- Development & Testing Procedures - Page L16-11 MEF-OOM&A-L16-11 Dr. M.E. Fayad Ambiguous or Unclear Event Names Clue # 4: Ambiguous or unclear event names Cause: Not identified Cure: Identify all the events and include them in the STD Start Stop Idle State Signal Processing Signal Arrives Process Signal Finished End Processing Signal Arrives and Finished are not clearly defined events Start Stop Idle State Heating Cooling Cold Enable Heat Warm Disable Heat Cold Enable Heat Hot Enable Cool
STD -- Development & Testing Procedures - Page L16-12 MEF-OOM&A-L16-12 Dr. M.E. Fayad Events with Continuous Instead of Discrete Signals Clue # 5: Events with continuous instead of discrete signals Cause: A signal is not an event. It is a raw data stream. Cure: Extract the events triggered by special data values Start Stop Idle State Control Temperature Temperature Control Control pH Temperature Disable Control pH Control pH pH Enable Idle
STD -- Development & Testing Procedures - Page L16-13 MEF-OOM&A-L16-13 Dr. M.E. Fayad Events with Continuous Instead of Discrete Signals (cont’d) Start Stop Idle State Control Temperature Wrong Temperature Enable Control Control pH Temperature OK Disable Control Wrong pH Enable pH Control pH OK Disable pH Control Temperature and pH are not events. They are continuous data streams.
STD -- Development & Testing Procedures - Page L16-14 MEF-OOM&A-L16-14 Dr. M.E. Fayad Practical Tips Only construct STDs for classes with meaningful dynamic behavior. –Not all classes require a STD. Check the various STDs for consistency on shared events so that the full dynamic model will be accurate. –Check for redundancy Use scenarios to help you construct STDs Distinguish between activities and actions. –Activities occur over a period of time. –Actions are instantaneous compared to the time scale of an application. Distinguish between events and conditions
STD -- Development & Testing Procedures - Page L16-15 MEF-OOM&A-L16-15 Dr. M.E. Fayad Practical Tips Use nested states when the same transaction applies to many states Most concurrency arises from object aggregation and need not be expressed explicitly in the STD. –Use composite states to show independent facets of the behavior of a single object Try to make the STDs of subclasses independent of the STDs of their superclasses. –The subclass STDs should concentrate on things unique to the subclasses. Beware of unwanted race conditions in the STDs –Race conditions may occur when a state can accept events from more than one object.
STD -- Development & Testing Procedures - Page L16-16 MEF-OOM&A-L16-16 Dr. M.E. Fayad Define nested states and race conditions describe how to construct a STD. Discussion Questions