R R R Object Modeling Approach CSE870 Advanced Software Engineeri 1 Object Modeling Approach R R R Start with a problem statement High level requirements Define object model Identify objects and classes Prepare data dictionary Identify associations and aggregations Identify attributes of objects and links Organize and simplify using inheritance Iterate and refine the model Group classes into modules CSE870 Advanced Software Engineeri 2 The Home Heating System Water Valve Water Pump Home Hot Water Controller Burner Fuel Valve 90 80 70 Fuel 60 Off On 50 Control Panel Temp Sensor R R R Home Heating Requirements The purpose of the software for the Home Heating System is to control the heating system that heats the rooms of a house The software shall maintain the temperature of each room within a specified range by controlling the heat flow to individual rooms The software shall control the heat in each room The room shall be heated when the temperature is 2F below desired temp The room shall no longer be heated when the temperature is 2F above desired temp The flow of heat to each room shall be individually controlled by opening and closing its water valve The valve shall be open when the room needs heat and closed otherwise The user shall set the desired temperature on the thermostat The operator shall be able to turn the heating system on and of The furnace must not run when the system is of When the furnace is not running and a room needs heat the software shall turn the furnace on To turn the furnace on the software shall follow these steps open the fuel valve turn the burner on The software shall turn the furnace of when heat is no longer needed in any room To turn the furnace of the software shall follow these steps close fuel valve turn burner of CSE870 Advanced Software Engineeri 4 Identify Object Classes R R R Requirements Statements Extract Nouns Eliminate Spurious Classes Candidate Classes Water Pump Object Classes Controller operator Hot Water Burner Tentative Object Classes furnace Home Heating System house thermostat room heating system Fuel Valve Water Valve range temperature desired temp Fuel on off switch heat Home software Temp Sensor CSE870 Advanced Software Engineeri Control Panel 5 Eliminate Bad Classes R R R Redundant classes Irrelevant classes Vague classes Classes that represent the same thing with diferent words Operations Roles Implementation details Classes we simply do not care about Classes with ill defined boundaries Attributes Sequences of actions are often mistaken for classes The name of a class should reflect what it is not the role it plays Save that for implementation Things that describe individual objects CSE870 Advanced Software Engineeri 6 Eliminate Classes R R R Redundant Irrelevant heating system Fuel user software Vague heat Attributes heat flow Hot Water desired temp house temperature home range Operations Roles None Implementation None Fuel Valve None Burner furnace Water Pump Home Heating System room thermostat operator Temp Sensor Controller on off switch Water Valve Control Panel CSE870 Advanced Software Engineeri 7 Classes After Elimination R R R Burner Fuel Valve Home Heating System Water Pump Room Thermostat Water Valve Furnace Temp Sensor Operator on off switch Control Panel Controller CSE870 Advanced Software Engineeri 8 R R R Prepare Data Dictionary Water Tank The storage tank containing the water that circulates in the system Pump 1 The pump pumping water from the Water Tank to the radiators in the rooms CSE870 Advanced Software Engineeri 9 R R R Possible Associations Not much information from the prose requirements A lot of information from the system design A room consists of a thermometer and a radiator A radiator consists of a valve and a radiator element The home heating system consists of a furnace rooms a water pump a control panel and a controller The furnace consists of a fuel pump and a burner The control panel consists of an on of switch and a thermostat The controller controls the fuel pump The controller controls the burner The controller controls the water pump The controller monitors the temperature in each room The controller opens and closes the valves in the rooms The operator sets the desired temperature The operator turns the system on and of The controller gets notified of the new desired temperature CSE870 Advanced Software Engineeri 10 Object Model Home Heating System Control Panel Furnace On Off Switch Burner Thermostat Pushes Adjusts Water Pump Runs Fuel Valv e 1 Room Opens Closes Operator Notif ies Ignites Water Valve Temp Sensor Monitor Actuates Controller Object Model Modified Home Heating System Control Panel Furnace On Off Switch Pushes Burner Thermostat Adjusts Runs Fuel Valve Opens Closes Ignites 1 Room Water Pump 1 Temp Sensor Monitor Water Valve Heats Notifies 1 Operator Controller Attributes R R R Thermostat desired temp On Off switch setting Temp Sensor temperature CSE870 Advanced Software Engineeri 13 Final OO Model Home Heating System Control Panel Furnace On Off Switch setting desired temp Pushes Burner Thermostat Adjusts Runs Fuel Valve Opens Closes Ignites 1 Room Water Pump 1 Temp Sensor temperature Monitor Water Valve Heats Notifies 1 Operator Controller R R R Iterate the Model Keep on doing this until you your customer and your engineers are happy with the model CSE870 Advanced Software Engineeri Iterate 15 R R R Operation vs Method Operation specifies object behavior Service represented by set of operns Message object requests execution of an opern from another object by sending it mesg Method mesg is matched up with method defined by the class to which the receiving object belongs or any of its superclasses Operations of class are public services ofered by class Methods of its classes are the implementations of these operations CSE870 Advanced Software Engineeri 16 R R R OO Using UML Dynamic Models Defining how the objects behave CSE870 Advanced Software Engineeri 17 R R Overview R 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 states CSE870 Advanced Software Engineeri 18 R R R Interaction Diagrams CSE870 Advanced Software
View Full Document