- 2071 Magh · 7 marks
Constraint specifications in bank account model
Short answer
Constraints add precision by stating rules. The model contains: {secure} restricts access to the portfolio-account link; {or} makes BankAccount either Corporation or Person exclusively; gender : {female, male} limits attribute values; and the marriage invariant ensures wife's gender is female and husband's male.
What is the role of constraint specifications in a model diagram? The model below depicts about possible types of accounts within the portfolio sub-head in any banking business domain. Identify the constraints highlighted and explain in brief, what they mean. [Figure: class Portfolio linked to class BankAccount with constraint {secure}. BankAccount is generalized into Corporation and Person, with an {or} constraint across the generalization. Person has the attribute gender : {female, male}. Person has a self-association, role husband 0..1 and role wife 0..1, with the constraint (self.wife.gender = female and self.husband.gender = male).]
Role of constraints
A constraint in UML is a condition or restriction placed on a model element. It gives more precise meaning than the graphical notation can show. It is written in braces { } or as a note, often in OCL (Object Constraint Language). Constraints
- state rules and invariants that the system must keep,
- remove ambiguity in the model,
- help in checking, testing and generating code, and
- can be attached to classes, associations, generalizations and attributes.
Constraints in the bank account model
+-----------+ {secure} +-------------+
| Portfolio |------------| BankAccount |
+-----------+ +-------------+
^
| {or}
+---------+---------+
+-------------+ +---------------+
| Corporation | | Person |
+-------------+ | gender : |
| {female,male} |
+---------------+
Person (husband 0..1) -------- (wife 0..1) Person
{self.wife.gender = female and self.husband.gender = male}
{secure}on the association betweenPortfolioandBankAccount: the accounts of a portfolio must be protected, so the link between a portfolio and its accounts may be used only through authorised access. It is a user-defined constraint stating that this relationship must be secure.{or}on the generalization: aBankAccountis either aCorporationaccount or aPersonaccount, never both at once (disjoint specialization).gender : {female, male}: an attribute constraint (enumeration). The attribute can take only one of the two listed values.self.wife.gender = female and self.husband.gender = male: an OCL invariant on the self-association ofPerson(marriage). For aPersonobjectself, the person in itswiferole must be female and the person in itshusbandrole must be male. The multiplicitieshusband 0..1andwife 0..1mean that a person has at most one husband and at most one wife.
These constraints make the model precise. They prevent invalid data such as an account owned by both a person and a corporation, or a marriage in which the "wife" is male.
✓ Answer checked by Claude Sonnet 5.5
Related questions
- Identify conceptual classes; create domain model · Object Oriented Analysis and Design, chapter 2
- XYZ Marina class diagram · Object Oriented Analysis and Design, chapter 2
- Event management system summary and class diagram · Object Oriented Analysis and Design, chapter 2
- Video rental shop class diagram · Object Oriented Analysis and Design, chapter 2
- Point of sale class diagram · Object Oriented Analysis and Design, chapter 2
- Deployment diagram as class diagram of nodes · Object Oriented Analysis and Design, chapter 3
- Time-domain specifications of 25/(s²+8s+25) · Control Systems, chapter 3
- SQL: number of accounts per branch · Database Management System, chapter 3
- Spillway model height, head and flow · Fluid Mechanics, chapter 10
- Channel fully in banking, 0.5-1.5 km · Estimating and Costing, chapter 6
All Object Oriented Analysis and Design chapter 2 questions →