240 likes | 406 Views
SOEN 343 Software Design. Section H Fall 2006 Dr Greg Butler http://www.cs.concordia.ca/~gregb/home/soen343h-f06.html. Miscellaneous. Domain Modeling: Larman ch 9 Use case modeling: Larman ch 6 Operation Contracts: Larman ch 11. Larman’s Design Process.
E N D
SOEN 343Software Design Section H Fall 2006 Dr Greg Butler http://www.cs.concordia.ca/~gregb/home/soen343h-f06.html
Miscellaneous Domain Modeling: Larman ch 9 Use case modeling: Larman ch 6 Operation Contracts: Larman ch 11
DEFINITION & MOTIVATION: Domain Model • A Domain Model visualizes, using UML class diagram notation, noteworthy concepts or objects. • It is a kind of “visual dictionary.” • Not a picture of software classes. • It helps us identify, relate and visualize important information. • It provides inspiration for later creation of software design classes, to reduce “representational gap.”
Guidelines 9.5 reuse existing model; use category list (see Table 9.1) identify noun phrases 9.9 Include Report Objects, eg Receipt 9.10 Think like a mapmaker 9.11 How to model the ‘unreal’ world 9.13 Description class, eg ProductDescription
GUIDELINES: Associations • Only add associations for noteworthy relationships. Literally, those for which making a “note” is worthy or business motivated.
Associations See Table 9.2
UML and GUIDELINES: Attributes • Show only “simple” relatively primitive types as attributes. • Connections to other concepts are to be represented as associations, not attributes.
GUIDELINES: Attributes • Why??
Ch 6: Use cases Review: done in SOEN 342 see separate slides Remember: use cases in context
Ch 11: Operation Contracts Aim: Define system operations via contracts Operation Method Invariant Precondition Postcondition
UML Definitions Event A significant or noteworthy occurrence. Operation An operation is a specification of a transformation or query that an object may be called to execute. [RJB1999] Signature of an operation specifies the name, parameters, and return type (and exceptions thrown). Pre-conditions and post-conditions are UML constraints specified using OCL (Object Constraint Language). Method [A method is] the implementation of an operation. It specifies the algorithm or procedure associated with an operation [OMG 2003]
Definitions Contract A contract specifies detailed changes, as a result of a system operation, to objects in the domain model using pre-conditions and post-conditions. Contract Format • Operation: name and parameters of operation. • Cross References: use cases that involve the operation. • Preconditions: noteworthy assumptions about the state of the system or object in the domain model before execution of the operation. • Postconditions: The state of objects in the domain model after completion of the operation. State A state is the condition of an object (or system) at a moment in time.
Describing the State of a System Describe the objects in the system Describe the links (relationships) between the objects Describe the properties of each object (ie the state of the object) = the (abstract) values of the object attributes [as in a state machine]
Invariant of a System or Object Invariant Is a condition which is always true about the state of the system (or object) Note: the state is only defined in between execution of operations Hence, invariant only has to be true before and after each operation, not during an operation
Postcondition Definition The postconditions describe changes in the state of objects in the domain model. Domain model state changes include instances created, associations formed or broken, and attributes changed. Note: postconditions are not actions to be performed during the operation They are the effect, ie observations about state of domain objects when the operation is finished. Ie, “what” not “how”
Writing Postconditions Document • Instance creation and deletion “A SalesLineItem sli was created” • Attribute change of value “sli.quantity became quantity” Note: quantity is an operation parameter • Association links formed and broken “sli was linked to the current Sale” “sli was linked with a productDescription based on itemID match” Use past tense.
Guidelines • Identify system operations from the SSDs. • For system operations that are complex and perhaps subtle in their results, or which are not clear in the use case, construct a contract. • To describe the postconditions, document • Instance creation and deletion • Attribute modification • Links formed and broken Use past tense for postconditions. Remember to document the forming of links!