2 Software Engineering Design Analysis Goal of engineering design analysis is to understand the software product design and the constraints (from requirements)The Engineering Design Analysis consist of 2 main tasksUnderstanding (studying, clarifying, prioritizing, etc.) the SRS and product designDeveloping a “new” model of the design problemThe result of design analysis “often” requires further clarification and rework of the SRS and product modelsoftware engineering designSRS/ProductDesignAnalyze (SRS &Product Design)PerformRest of DesignStepsDesignDocRecall Product Design is really requirements (your text author)
3 Engineering Design Analysis Engineering Design Analysis Model is a representation of a design “problem” (the modeling of the issues related to requirements)Dynamic aspects may be represented with Use Case Diagram and Use Case Description whichDefines the major system functionalitiesDefines the entities or actors (mostly users and other systems) that interact with the systemDescribes the actual interactions via scenario descriptionsStatic aspects may be represented with Conceptual Model (or Analysis Class Model if using OO).(Using OO techniques)Defines the “Classes” in the problemDefines the Associations among ClassesNote: Both Use Case Diagram/Descriptions and Conceptual Model (OO Class Diagram) may be used for both requirements and design activities
4 Use Case and Conceptual Model Also represents the problem/solution, the static aspectsDoes not “quite” describe the solution, but starts toDoes describe (more details of)the real world and possible artificial entitiesrelationships among these entitiesUse Case:Represents the requirements and the behavior of the needed systemDoes not describe the solution‘Usually” does not describe in detail the entities or the structure in the problem/solution (does describe interactions between actors and the system)
5 3 Levels of Model in Analysis and Design OO ModelConceptual Model (or Domain Model) : represents the entities in the problem domain - a) their characteristics, and b) relationships among the entities (the entities may be represented in the form of OO classes)Design Class Model: represents the entities in the solution – a) their attributes, b) operations, and c) relationships among the entities independent of the implementation language or platformImplementation Class Model: represents the classes in the implementation of the solution and all the details which were left out in the Design Class ModelOO Code
6 Conceptual ModelConceptual model is the “bridge” between requirements (problem) and design (solution).Conceptual Modeling is used for Analysis of “mostly” requirements:Understanding the problem domain:the major entities,the responsibilities (or functionalities) of these entities,and the relationships among these entitiesUnderstanding the data requirements that are associated with entities, their characteristics, and their relationshipsReviewing/Inspection of the SRS against the Conceptual ModelWith a Conceptual Model, many of the entities, characteristics, responsibilities,and relationships that are portrayed in the problem domain may be transformedinto classes, attributes, operations, and associations in the Design Model
7 RESPONSIBILITY-DRIVEN DESIGN [Wirfs-Brock et al RESPONSIBILITY-DRIVEN DESIGN [Wirfs-Brock et al., original work in 1990]Design technique driven by the delegation of responsibilitiesGoal -- To focus on building a model of interacting objects before filling out precise details of each classInvolves reducing data & control dependencies between modules (information hiding) and designing reusable codePhilosophy -- No action can take place without an agent (object) performing the action.Central focus of OOD -- establishing WHO is responsible for each action
8 CRC CardsUsing CRC cards is a popular approach that works with Responsibility-Driven Design to help identify the “key” components of the problem arena.CRC cards: Class, Responsibility, & Collaboration An object’s responsibilities are high-level statements about the knowledge it maintains and the operations it supports A collaboration is a request made by one object to another Each class = a CRC cardC : Class (“key” component)R : Responsibility (functionality/feature)C : Collaboration (interfaces with other Classes)
9 CRC cards show the identified Entities/Classes class name______________________________________________[subclass: ][superclass: ]responsibilities collaboratorsCRC cards show the identified Entities/ClassesThese are found in requirements (from Use Case) are often “directly” converted to Classes to be used in the Design
10 So --- How do we come up with an entity (CLASS)? A CLASS is an abstraction of an entity in requirements at this stage.The entity may be a “real” physical world item described in the requirements document(e.g.)“A patient form must be filled by each patient” ---- (in describing the requirements for a hospital admittance process.)The entity may be a conceptual (man-made) item described in the requirements“When the patient’s accrued backlog payment amount is more than $10,000, a statement of possible financing alternatives is included in the financial invoice statement to the patient” ---- (in describing the billing statement of a hospital system)(note that financial invoice statement may be verbal, electronic, or paper in form; but it is not a “real” world item.)At the Conceptual Design level, we are dealing with requirements/design. Thus the“major entities” mentioned in the requirements document are candidates forCLASSES.CLASSES may have to be defined and altered several times in Conceptual Design andeven in the later Design Class Model !
11 Identifying Key Components Identifying key components or Classes is the first step.Just “listing” the Classes’ names (no other information about the Classes, yet)After thinking about what functionalities (or responsibilities) these Classes should possess (we may actually change our minds and combine some Classes ---- we now are starting to drop into “Designing Class Model”)We may start to associate Classes in terms of relationships
12 CLASS Representation in UML A Class is composed of 3 parts:Class namecharacter string that identifies the ClassClass attributeslist of characteristics of the Class that are eventually stored in “variables” and “constants”Class operationslist of services or functionalities provided by the ClassPatientP_Name: string [1.. 40]P_Address: string [1..50]P_Phone: string [1..10]P_Age: int.Get_P_Name( ): stringGet_P_Addres( ): stringInput_P_Name ( ).1) Coming up with CLASS is an important and difficult design task!!!2) At this point, don’t get too tangled up in the details.)
13 Class Attribute Specification Format name : type [multiplicity ] = initial valuename : a “simple” name to identify the attribute;type : name of the data type or class type;multiplicity : the number of values stored in the attribute;initial value : initial value assigned to the attribute;Some notes: -at the analysis level, we will ONLY have the NAMEmultiplicity may be comma separated list of ranges of non-negativenumbers, where each range is in the form of j---k (e.g )* stands for unlimited upper bound 0---* mean 0 or moreif multiplicity is suppressed, it is assumed to be 1 and the [ ] may be dropped
14 Class Operations Specification name ( parameter-list ) : return-type-listname : a “simple” name of the operationparameter list : a comma separated list of names and types of the parameters of this operation in the form of :direction param-name : param-type = default valuedirection is either in, out, inout, return ; if suppressed it is assumed to be inparam-name is the simple name of the parameterparam-type is the data type or class of the parameterdefault value is the initial value of the parameter if it is not specified3. return type list : a comma separated list of types of values returned by the operationNote: - both parameter-list and return-type-list may be suppressed- if parameter-list is suppressed, the parenthesis, ( ), must still show- at the analysis level, we will ONLY have the NAME
15 Using CLASS diagrams for Conceptual Modeling In describing or developing a “SOLITAIRE System”, the deck of cards and card may be thought of as CLASSesDiscuss:1. Should deck and card be a single CLASS or two classes?2. If so what may be its (their) attributes and operations?- as we ask these questions --- we may also beclarifying our requirements- class diagram may also be viewed as a conceptualmodeling tool for static structure of the requirements
16 A simple CLASS Diagram doctor patient visitdoctorpatientA Class diagram is composed of 2 main set of items:ClassesAssociations among Classes1What happens whena doctor visits anotherdoctor as a patient?(use role names?)order0..Nlab_test1. doctor, patient, and lab_test are the Classes.2. The “lines” represent associations among these classes.The associations may also be labeled with “visit” and “order”Constraints may be placed on the associations (e.g. lab-test must be ordered by at least one doctor but a doctor may order 0 to N lab testsNavigability may also be placed on the association, with arrows,(e.g. would show the association from the end towards the arrow)This constraintIs called multiplicity
17 Association among several Classes storesbookslibraryCDsThe library stores books and stores CDs; the diamond is used as the connection.This multiple association can be confusing sometimes.
18 CRC Technique for Modeling Class-Responsibility-Collaboration (CRC) is an object oriented modeling technique:Identify a Class (look for NOUNS in the initial requirements)Define the responsibilities of the ClassDefine the collaborations (dependencies) among the ClassesFor Conceptual Model,the Class may be a physical or non-physical entity in the problem domain.Responsibilities are the services (or functionalities) that the Class will provideCollaboration shows the relationships among the classesA CRC card is a 3x5 card that lists the Class name, its set of responsibilities, and the names of other Classes it interacts with.In “theory,” Conceptual Model for Design Analysis contain only Classes which are real-world entities that are in the requirements --- but in practice we also start to include non-real world entities and invent (getting into design) new classes.
19 Discuss the “Meaning” of the Following (Key Components) Class Diagram 1creates1..ncustomerShopping-cart11buysmovedCan a cart be createdby more than 1 customerorCan the (same) item be bought bymore than 1 customer?1..n1..nitem
20 Discuss the Meaning of Following Class Diagram 1creates1..nCustomerCartname: stringaddress: stringcardNumber: int0..1cartId: inttotalPrice: floattotalItmes; Int1buysmovedcalcPrice( ): float1... *1.. *ItemDo you agree with1..* and 1..n ?itemId: intitemPrice: floatiteminStock: boolnote: - the associations are verbs- the designers would haveto decide where to put them(e.g. in which class?)getPrice( ): floatinStock(ItemId): bool
21 Recommended Heuristics & Conventions for Class Diagram Classes, attributes, and roles most likely come from “noun phrases” in requirements/use caseOperations and associations most likely come from “verb phrases” in requirements/use caseIn Class Diagram, capitalize the Class name, but not the othersStick to binary associations as much as possible because associations among three or more classes are harder to understand.Avoid role names and use association names as much as possible because of possible confusionPlace multiplicity, and association on the opposite side of the association of a single instance of class.
22 Example from Text (page 214) Caldera is a smart water-heater-controller that attaches to the thermostat of a waterheater and provides more efficient control of the water temperature to save money andprotect the environment. Caldera sets the water heater thermostat high when hot wateris much in demand and sets it low when there is not much demand. For example,Caldera can be told to set the thermostat high on weekday mornings and evenings andall day on weekends, and low during the middle of weekdays and at night.Furthermore, Caldera can be told to set the thermostat high all the time in case ofillness or other need, or be told to set the thermostat low all the time in case of vacationor some other prolonged absence from home.The homeowner can specify values for the following Caldera parameters:- Low Temp – temperature when little or no hot water is needed- High Temp – temperature when much hot water is needed- Weekend Days – days when the thermostat will be set to High Temp all day long;on all other days it will be set between Low Temp and High Temp.- Peak times – From 1 to 3 time periods on a 24 hour-click during which thermostat willbe set to High Temp on non-Weekend Days. On Weekend Days, thethermostat will be set to High Temp during the entire period betweenthe earliest time and the latest time set in Peak times.Caldera has the following states called modes:i) Stay Low mode – Thermostat is set to stay at Low Tempii) Stay High mode – Thermostat is set to stay at High Tempiii) Normal mode – Thermostat is changed between Low Temp and High Temp on aregular schedule, as explained above.Caldera has its own internal clock that it checks every second to determine how to setthe water heater thermostat
23 Example from Text (page 214) Caldera is a smart water-heater-controller that attaches to the thermostat of a waterheater and provides more efficient control of the water temperature to save money andprotect the environment. Caldera sets the water heater thermostat high when hot wateris much in demand and sets it low when there is not much demand. For example,Caldera can be told to set the thermostat high on weekday mornings and evenings andall day on weekends, and low during the middle of weekdays and at night.Furthermore, Caldera can be told to set the thermostat high all the time in case ofillness or other need, or be told to set the thermostat low all the time in case of vacationor some other prolonged absence from home.The homeowner can specify values for the following Caldera parameters:- Low Temp – temperature when little or no hot water is needed- High Temp – temperature when much hot water is needed- Weekend Days – days when the thermostat will be set to High Temp all day long;on all other days it will be set between Low Temp and High Temp.- Peak times – From 1 to 3 time periods on a 24 hour-click during which thermostat willbe set to High Temp on non-Weekend Days. On Weekend Days, thethermostat will be set to High Temp during the entire period betweenthe earliest time and the latest time set in Peak times.Caldera has the following states called modes:i) Stay Low mode – Thermostat is set to stay at Low Tempii) Stay High mode – Thermostat is set to stay at High Tempiii) Normal mode – Thermostat is changed between Low Temp and High Temp on aregular schedule, as explained above.Caldera has its own internal clock that it checks every second to determine how to setthe water heater thermostat
24 Initial “Sample” set of Classes (Conceptual Modeling of the Domain) Water-heater-controllersetsThermostatspecify parameterstemplowTemphighTempwkendDayspkTimesmodeHomeownerchecksClockIs this an “actor”outside of theUse Case &thus not a Domain Class ?timeAttribute types are left as suppressed first because ?What about responsibilities or functionalities?
25 Initial Sample set of Classes, “refined” Water-heater-controllersetsThermostatspecify parameterssetting: TemplowTemp : TemphighTemp: TempwkendDays: Day[0..7]pkTimes: Time[1..3]mode: ModeHomeowner-InterfacechecksClockbecoming aSoftware ClasssetMode ( ):booleantime1) Defining attribute types as semantic (UDT) with multiplicties abstracts design decisions until later.2) By putting setMode( ) in as the responsibility of water-heater-controller, we have started on our design from Conceptual Model to Design Class Model3) Changing Homeowner to Homeowner Interface is moving out of Conceptual Modeling
26 Conceptual Modeling Activity Heuristics Identify important requirements (problem) concepts through the SRS document - potential classes:Physical entities, individuals, roles, groupsItems tracked, recorded, or presentedPeople, devices, systems that interact with the systemAdd attributes to the classCharacteristics such as size, color, model number, or any identifierAdd operationsBehavior of the classAdd associations based on relationships such as:Control, coordinate, attend, supervise, send, order, part of, is-a, above, inside, etc.Conceptual ModelingSRSIdentify classesAdd attributes andoperations-You mayiteratewithinMay notfollow thesequenceidentify associationsAdd associationconstraintsClassDiagram1. Note that most of the classes are represented as “noun or noun phrases”2. Note that most of the attributes and behavior are in “noun” and “verb” forms, respectively.
27 Some Thoughts to Keep in Mind as You do Conceptual Modeling & Design Use “meaningful” names to represent your thought, especially for those non-physical entities. e.g. Class name, attribute name, etc.Strive for coherent components --- grouping attributes and actions that are “related” as you design the Class.Ensure that what you are portraying is accurate --- e.g. it does represent what you wantDo not insert extraneous material, which are not called for in the requirements, into the Design. e.g. additional generalization for the future.Check that the design is complete – e.g. all characteristics and functionalities from requirements are included.