Short Questions for Operation Contracts

  • 1 How to Create and Write Contracts?


    Create Contract

    • Identify system operations from the SSDs.
    • For system operations that are complex, or which are not clear in the use case, construct a contract.
    • To describe the post-conditions, use its categorization
    Writing Contracts

    • As mentioned, write in a declarative, passive past tense form (was …)
    • Remember to establish an association between existing objects or those newly created.
      • The SalesLineItem was associated with the Sale (association formed).

  • 2 Describe some guideline for writing a post condition in operation contract?


    • Express them in the past tense to emphasize on observations about state changes e.g. "A Sales LineItem was created" Rather than "Create SalesLineItemComplete"
    • It is not important to write all post-conditions for all system operations.
    • Write contracts for the most complex and subtle system operations
    • Treat their creation as an initial best guess
    • When new conceptual classes, attributes, or associations are discovered then update the domain model accordingly.
    • Enhance it as you make new discoveries while thinking through operation contracts
    • Avoid common mistakes:
      • Forgetting to include the forming of associations when new instances are created,
      • it is very likely that associations to several objects need be established

  • 3 What are the categories in which the post conditions of operation contract are categorized?


    The post condition of an operation will belongs to one of the following category:

    • Instance creation and deletion.
    • Attribute change of value.
    • Associations (to be precise, UML links) formed and broken.

  • 4 Write the operation contract for the enterItem system operation of Process Sale use case of NextGen POST System.


    • Contract ID: enterItem
    • Operation: enterItem(itemID: ItemID, quantity: integer)
    • Cross References: Use Cases: Process Sale
    • Pre-Condition: There is a sale underway.
    • Post Conditions:
      • A SalesLineItem (SLI) instance was created (instance creation).
      • SLI was associated with the current Sale (association formed).
      • SLI quantity became quantity (attribute modification).
      • SLI was associated with a ProductDescription, based on itemID match (association formed).

  • 5 What are the sections of operation contract? Describe each briefly.


    Following are the main sections:

    1. Contract ID: A Brief Name of the contract
    2. Operation: Name of operation, and parameters
    3. Cross References:Name of use cases in which this operation can occur
    4. Pre-conditions: Noteworthy assumptions about the state of the system or objects in the Domain Model before execution of the operation. These are non-trivial assumptions the reader should be told.
    5. Post-conditions:This is the most important section. This section describes the state changes of objects, their association and construction/destruction.

  • 6 What are the main objectives of operation contracts?


    • Define system operations.
    • Create contracts for system operations.

Contact Us
Write to Us View Help
Subject Expert Logo

Subject Expert

Learn and Evaluate

Follow Us
© 2020 - Subject Expert