Skip to main content

Creating Class Diagrams with Umbrello 5: Guide

Table of Contents

  1. Introduction to UML Class Diagrams
  2. Understanding Class Diagram Components
  3. Problem Statement: Credit Card System
  4. Installation and Setup
  5. Creating Your First Class Diagram
  6. Building the Class Structure
  7. Implementing Relationships

1. Introduction to UML Class Diagrams

What are Class Diagrams?

Class diagrams are the backbone of Object-Oriented modeling. They show:

  • Static structure of a system
  • Classes and their features
  • Relationships between elements
  • Inheritance hierarchies
  • Multiplicity and navigation

Why Use Class Diagrams?

  • Visualize class structures
  • Plan application structure before coding
  • Document existing systems
  • Communicate designs between team members
  • Model database schemas

2. Understanding Class Diagram Components

Classes

A class represents a template for objects and consists of:

  • Name (top compartment)
  • Attributes (middle compartment)
  • Operations (bottom compartment)

Visibility Modifiers

+ Public: Accessible from any class
- Private: Only accessible within the class
# Protected: Accessible in class and its subclasses
~ Package: Accessible within the same package

Relationships Types

  1. Association: Basic relationship between classes

    • Unidirectional: One-way relationship
    • Bidirectional: Two-way relationship
  2. Aggregation: Weak "whole-part" relationship

    • Parts can exist independently
    • Shown with hollow diamond
  3. Composition: Strong "whole-part" relationship

    • Parts cannot exist without the whole
    • Shown with filled diamond
  4. Inheritance: "is-a" relationship

    • Shown with hollow triangle
    • Points to parent class
  5. Implementation: Class implementing interface

    • Shown with dashed line and hollow triangle
    • Points to interface

Multiplicity

  • 1: Exactly one
  • *: Zero or more
  • 1..*: One or more
  • 0..1: Zero or one
  • n: Specific number
  • n..m: Range of numbers

3. Problem Statement: Credit Card System

System Overview

Creating a credit card management system that handles:

  • 6.5 million cardholders
  • 500,000 retailers
  • Various retail types (hotels, shops, etc.)
  • Transaction processing
  • Statement generation

Class Diagram

Key Requirements

  1. Transaction Processing

    • Validate transactions over $50
    • Generate two-part vouchers
    • Track transaction status
  2. User Management

    • Store cardholder information
    • Manage retailer details
    • Handle credit limits
  3. Reporting

    • Generate monthly statements
    • Track transaction history
    • Monitor credit usage

4. Installation and Setup

Prerequisites

  • Linux/Windows operating system
  • Umbrello 5 installed
  • Basic understanding of UML concepts
  • Familiarity with object-oriented programming

Environment Setup

  1. Launch Umbrello from terminal:
umbrello5
  1. Configure initial workspace:
    • Maximize window for better visibility
    • Arrange toolbars as needed
    • Enable grid view for alignment (optional)

5. Creating Your First Class Diagram

Step 1: Create New Diagram

  1. Click File → New
  2. Name project "Credit Card System"
  3. Select "Class Diagram" from available options

Create New Class Diagram

Tip: Use meaningful project names that reflect your system's purpose

Name Diagram

6. Building the Class Structure

Creating the CreditCardCompany Class

  1. Add Class
    • Right Click your mouse
    • From New --> Class
    • Name it "CreditCardCompany"

Create New Class Name Class

  1. Configure Class Properties
    • Right-click on the class → Properties

Open Properties

  1. Add Attributes

    - companyName: string (private)
    - transactionThreshold: float (private)
    - minCreditLimit: float (private)

    For each attribute:

    • Click "New Attribute"
    • Set name, type, visibility

Add Attributes Add Attribute Properties

Important: Choose appropriate visibility modifiers based on encapsulation principles

  1. Add Operations

    + checkCredit(): boolean
    + authorizeTransaction(): boolean
    + generateMonthlyStatement()

    For each operation:

    • Click "New Operation"
    • Set name, return type, visibility
    • Click Apply and then OK

Add Operations Add Operation Properties Add More Operations

Creating the CardHolder Class

  1. Add Class Structure

    Class: CardHolder
    Attributes:
    - cardHolderId: string
    - name: string
    - creditLimit: float
    - cardNumber: string

    Operations:
    + makePayment()
    + getCreditStatus(): boolean
    + viewStatement()
  2. Configure Class Properties

    • Set proper visibility for attributes
    • Add validation methods
    • Configure relationships

Creating the Transaction Class

  1. Define Transaction Structure
    Class: Transaction
    Attributes:
    - transactionId: string
    - amount: float
    - date: Date
    - status: string
    - needsAuthorization: boolean

    Operations:
    + authorize(): boolean
    + createVoucher()
    + checkThreshold(): boolean

Add More Classes After Adding All Classes

7. Implementing Relationships

Creating Class Relationships

  1. Composition Relationships
    • CreditCardCompany to CardHolder (1 to 6.5M)
    Steps for each:
    • Select composition tool
    • Click source class
    • Drag to target class
    • Configure multiplicity

Select Composition 2. Setting Multiplicities

  • Click on relationship line
  • Open properties
  • Set source and target multiplicities
  • Configure navigation

Select Component and Open Properties Add Multiplicity

  1. Add More Association and Multiplicity Add Association Add Multiplicity

Saving and Exporting

Saving Your Work

  1. Go to File → Save As
  2. Choose a location and filename
  3. Select .xmi format

Printing or Exporting

  1. Go to File → Print or Export
  2. Select desired format and options