OO Using UMLOverviewInteraction DiagramsWe Will CoverDifferent Types of Interaction DiagramsHome Heating Use-CaseSequence DiagramsExample from FowlerConcurrencyAnother ExampleComment the DiagramCollaboration DiagramsConditional BehaviorComparisonWhen to Use Interaction DiagramsState DiagramsSlide 17Events, Conditions, and StatesMaking a Phone Call ScenarioPartial Class DiagramEvent TraceState Diagram for ScenarioScenario 2Modified State MachineConditionsOperations (AKA Actions)Hierarchical State MachinesInformation HidingEvent GeneralizationSlide 30State Machines - SummaryWhen to use State MachinesComing up with the State DiagramsModeling ApproachScenario-1Scenario-2Dynamic ModelMore Dynamic ModelEven More Dynamic ModelIdentify Key OperationsComplete OO ModelIterate the ModelActivity DiagramsSlide 44Slide 45Why Activity DiagramsCoffee ExampleHACS Use-CasesActivity Diagrams for Use CasesSwimlanes (Who Does What?)Problems with Activity DiagramsWhen to Use Activity DiagramsApproaching a ProblemWhere Do We Start?How Do We Continue?How Do We Wrap Up?Why is requirements analysis difficult?Slide 58First Law of Software EngineeringReasons for changing requirementsRequirements ProductsAnalysis: Steps to followUse CasesAnalysis: Object ModelSlide 65Slide 66Object Model: Steps to followAnalysis: Dynamic modelDynamic Model: Steps to followAnalysis: IterationRRROO Using UMLDynamic ModelsDefining how the objects behaveRRROverview•The object model describes the structure of the system (objects, attributes, and operations)•The dynamic model describes how the objects change state (how the attributes change) and in which order the state changes can take place•Several models used to find the appropriate dynamic behavior–Interaction diagrams–Activity diagrams–State Diagrams•Uses finite state machines and expresses the changes in terms of events and statesRRRInteraction DiagramsRRRWe Will Cover•Why interaction diagrams?•Sequence diagrams–Capturing use-cases–Dealing with concurrency•Collaboration diagrams•When to use what•When to use interaction diagramsRRRDifferent Types of Interaction Diagrams•An Interaction Diagram typically captures a use-case –A sequence of user interactions•Sequence diagrams–Highlight the sequencing of the interactions between objects•Collaboration diagrams –Highlight the structure of the components (objects) involved in the interactionRRRHome Heating Use-CaseUse case: Power UpActors: Home Owner (initiator)Type: Primary and essentialDescription: The Home Owner turns the power on. Each roomis temperature checked. If a room is below thethe desired temperature the valve for the room is opened, the water pump started, the fuel valveopened, and the burner ignited. If the temperature in all rooms is above the desiredtemperature, no actions are taken. Cross Ref.: Requirements XX, YY, and ZZUse-Cases: NoneSequence Diagramsa H o m e O w n e r t h e O n - O f f S w i t c h t h e C o n t r o l l e r a R o o m t h e W a t e r P u m pS y s t e m O np o w e r O n ( )* [ f o r a l l r o o m s ]t e m p S t a t u s : = c h e c k T e m p ( )[ t e m p S t a t u s = = l o w ]p u m p O n ( )[ t e m p S t a t u s = = l o w ]o p e n V a l v e ( )[ t e m p S t a t u s = = l o w ]s t a r t B u r n e r ( )Example from Fowlera n O r d e r e n t r yW i n d o wa n O r d e r a n O r d e r L i n e a S t o c k I t e mp r e p a r e ( )* [ f o r a l l o r d e r l i n e s ]p r e p a r e ( )h a s S t o c k : = c h e c k ( )[ h a s S t o c k ]r e m o v e ( )n e e d s R e o r d e r : = n e e d s T o R e o r d e r ( )a R e o r d e r I t e m[ n e e d s R e o r d e r ]n e w[ h a s S t o c k ] n e wa D e l i v e r y I t e mM HConcurrencya T r a n s a c t i o na T r a n s a c t i o nC o o r d i n a t o ra f i r s t T r a n s a c t i o nC h e c k e ra s e c o n dT r a n s a c t i o nC h e c k e ra l l D o n e ?n e wn e wn e wn e wa l l V a l i do ko ka l l D o n e ?Another Examplea H o m e O w n e r t h e O n - O f f S w i t c h t h e C o n t r o l l e ra R o o mt h e W a t e r P u m pS y s t e m O np o w e r O n ( )[ t e m p L o w ]p u m p O n ( )[ t e m p L o w ]o p e n V a l v e ( )[ t e m p L o w ]s t a r t B u r n e r ( )* [ f o r e a c h r o o m i n h o u s e ]n e wc h e c k T e m p ( )t e m p L o wM HComment the Diagrama H o m e O w n e r t h e O n - O f f S w i t c h t h e C o n t r o l l e ra R o o mt h e W a t e r P u m pS y s t e m O np o w e r O n ( )[ t e m p L o w ]p u m p O n ( )[ t e m p L o w ]o p e n V a l v e ( )[ t e m p L o w ]s t a r t B u r n e r ( )* [ f o r e a c h r o o m i n h o u s e ]n e wc h e c k T e m p ( )t e m p L o wM HW h e n t h e o w n e rt u r n s t h e s y s t e m o nt h e o n s w i t c h n o t i f i e st h e c o n t r o l l e rT h e c o n t r o l l e rc r e a t e …
View Full Document