Identify ways to derive attributes and extend the sequence diagram to support Data access
Identify Ways to discover Attributes
Information maps to attributes
Every piece of information used by a system must be defined as an attribute. Every attribute must be owned by an object.
Even if an attribute is derived and is never actually stored, some object has to own the rules for deriving it.
Every argument in an operation must have a source. Does the object that initiates the event own the data? If it does not own the data, then where does it get the data? Look in the class diagram and find the class that should own the data. Update the sequence diagram to show how the initiating object obtained the data from the owning object.
Example: Expanding a sequence diagram for a parameter
Below is the class diagram segment for this example project Purchase Seats use case:
The initial sequence diagram for the Purchase Seats use case:
The same logic applies to operation returns. Does the responding object own this data? If it does not own the data, then where does the object get it?
Does the object derive the data using another of its own operations? Does the object have to look up the value using other objects? Update the sequence diagram to add the object(s) that own the data and show how the original object obtained the data.
An example of expanding a sequence diagram for a return
Using the course project as an example, when a customer wants to buy show seats, he or she must provide a price type for each seat in order for the system to know which price to charge, that is, adult, student, senior citizen, or child.
For instance, I could buy four tickets, two for adults and two for children:
To find the price for ShowSeat, ShowSeat must ask for the price from PriceTier. When asking for the price, ShowSeat must provide a price type so that PriceTier can decide which price to return.
Each time you add a new interaction, you iterate through the modeling process:
Evaluate the class diagram to find the objects that participate in the interaction.
Add the new object(s).
Identify the new events.
Reevaluate the purpose of the participating objects.
Convert the events to operations.
Convert the information to attributes.
Assign ownership of the attributes.
Repeat until all parameters and returns are accounted for.