110 likes | 309 Vues
Week 4. Operational Contracts Requirements to Design Logical Architecture. OO Analysis and Design Process. Domain Model Classes Attributes Associations Use Cases System Sequence Diagrams Interaction Diagrams Operation Contracts Software Object Design ** Classes Communications
E N D
Week 4 • Operational Contracts • Requirements to Design • Logical Architecture
OO Analysis and Design Process Domain Model • Classes • Attributes • Associations Use Cases • System Sequence Diagrams • Interaction Diagrams • Operation Contracts Software Object Design ** • Classes • Communications • Operations and Methods • Don’t get hung up on terminology. • Architecture -System vs Logical • Domain Model vs Domain Layer
Chapter 11 Operational Contracts What are they? When and Why are they used?
Operational Contract “Contracts describe changes that are likely required in the software objects.” • Detailed description of behavior • Consider it optional but useful • Components of a contract: • Operation signature – just a name • Cross reference – refer to use cases • Pre conditions – assumption about the state • Post conditions – state after completion
Example: enterItem Operation: enterItem(itemID: ItemID, quantity: interger Cross Reference: Use Cases: ProcessSale Preconditions: There is a sale underway Postconditions: A SalesLineItem instance sli was created sli was associated with current Sale sli.quantity became quantity sli was assoicated with a ProductDescription, based on itemID match
Fig. 11.2 Events trigger operations Process sale
Post Conditions • Changes in the state of objects in the domain model • Observations not operations • Three domain object state changes • Instance created or deleted • Attribute value changed • Association formed or broken
When Are Contracts Useful • When complexity of required state changes too awkward/detailed to capture in use cases • Describe what happens, not how • Sales Line Item associated with the sale by stapling papers • Proof of correctness (axiomatic semantics) • Testing and verification
How to Create and Write Contracts • Past tense descriptions and observations • Stage and curtain analogy • How complete? • Best guess is a good start • Better to start with something that can be improved • Improves analysis and understanding • Useful for operations that are “complex and subtle.” • Go back and update the Domain Model as needed. • Do one for your project – just to do it.
Summary • Update the domain model? • When? • System operations that are complex or subtle • Most common mistake? • Forgetting associations