Modeling constraints in UML: When a business rule involves three or more symbols, is it acceptable to present the constraint as a note and attach that note to each applicable symbol with a dashed line?
-
ACorrect
-
BIncorrect
-
CAllowed only in sequence diagrams
-
DOnly valid for preconditions, not business rules
-
ERequires a stereotype, not a note
Answer
Correct Answer: Correct
Explanation
Introduction / Context: Constraints capture additional rules that cannot be expressed simply by standard connectors or multiplicities. UML provides a general note mechanism and an explicit constraint syntax to annotate model elements and relationships, improving precision while keeping diagrams readable.
Given Data / Assumptions:
- A business rule relates three or more model elements.
- We want a clear, concise way to show the rule without overcomplicating connectors.
- We use standard UML notation (notes, constraints in braces).
Concept / Approach: UML allows attaching a note (a dog-eared rectangle) to one or more elements via a dashed line. A constraint can be written inside the note, often enclosed in braces { } or expressed in a formal language such as OCL. When a rule involves several symbols, linking a single note to each relevant element communicates the dependency clearly and avoids cluttering the diagram with ad-hoc text near each element.
Step-by-Step Solution:
Write the rule concisely inside a note (for example, {An Order must reference at least one LineItem and one Payment}).Attach the note to all affected elements with dashed lines.Optionally, reference the constraint in documentation or use OCL for formal semantics.Confirm the diagram remains readable and unambiguous.Verification / Alternative check: Compare with embedding text near each symbol or inventing new icons; the note approach is standardized and widely supported by modeling tools, ensuring consistent interpretation.
Why Other Options Are Wrong:
- “Incorrect” ignores standard note usage.
- Limiting to sequence diagrams or preconditions is inaccurate; notes apply across UML diagram types.
- A stereotype is unnecessary to express a rule in a note.
Common Pitfalls: Overloading notes with long prose; failing to attach the note to all involved elements, which can obscure scope of the rule.
Final Answer: Correct