UML class notation: Is a class drawn as a rectangle with three compartments separated by horizontal lines (not vertical), typically for name, attributes, and operations?

Difficulty: Easy

Correct Answer: Incorrect

Explanation:


Introduction / Context:
Recognizing standard UML notation is essential for reading and producing consistent design diagrams. The class symbol is among the most frequently used elements. Misremembering its layout can cause confusion when communicating designs across teams.


Given Data / Assumptions:

  • The statement claims a class is represented by a rectangle with three compartments separated by vertical lines.
  • Typical UML class notation shows compartments for name, attributes, and operations.
  • We assume mainstream conformance to UML 2.x.


Concept / Approach:
In UML, a class is drawn as a rectangle partitioned by horizontal lines into up to three compartments: top (name, and possibly stereotypes), middle (attributes), bottom (operations). Vertical partitions are not standard for the class symbol. Some tools allow additional subcompartments (for visibility grouping), but the standard separation is horizontal, not vertical. Therefore, the statement is incorrect.


Step-by-Step Solution:

Recall the class icon: a rectangle divided horizontally.Top compartment: class name (optionally stereotypes and constraints).Middle: attributes; Bottom: operations.Conclude that “vertical lines” is wrong; horizontal is correct.


Verification / Alternative check:
Check any UML reference card or modeling tool defaults; class compartments are stacked vertically (separated by horizontal rules).


Why Other Options Are Wrong:

  • “Correct” contradicts the spec.
  • Version- or tool-dependence does not switch the basic orientation.
  • Abstract classes use the same symbol, often with italicized name.


Common Pitfalls:
Confusing class compartments with package or component rendering; overloading diagrams with too many attributes/operations leading to clutter.


Final Answer:
Incorrect

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion