How to Draw UML Class Diagrams in Dia (Step-by-Step)

Dia Tutorials · UML · Updated October 2026

About this guide: This is an independent community resource for Dia users. We are not affiliated with the GNOME project or the Dia developers. Dia is free, open-source software released under the GNU GPL.

Dia is one of the most practical free tools for drawing UML class diagrams. It is lightweight, works fully offline, and its dedicated UML sheet covers the symbols you actually need: classes, interfaces, associations, aggregation, composition, and generalization. If you are documenting a codebase, preparing a software design document, or studying UML for a course, this step-by-step tutorial shows you exactly how to build a clean class diagram in Dia — no prior experience required.

Before you start, make sure Dia is installed. If you have not installed it yet, see our Dia download page or the Windows installation guide.

Step 1: Open Dia and Select the UML Sheet

Launch Dia. You will see two windows: the Toolbox (with drawing tools) and an empty canvas. (Tip: starting Dia with the --integrated option merges them into a single window.)

  1. In the Toolbox, find the drop-down menu at the top that lists shape collections (“sheets”). It may currently say “Assorted” or “Flowchart”.
  2. Click the drop-down and select UML.
  3. The Toolbox now shows UML objects: Class, Interface, Association, Aggregation, Composition, Generalization, Dependency, Realization, Note, and others.
Can’t find the UML sheet? Go to File > Sheets and Objects, make sure “UML” is checked, and restart Dia.

Step 2: Place Your First Class

  1. Click the Class tool in the Toolbox.
  2. Click anywhere on the canvas. A class box with three compartments appears: name, attributes, and operations.
  3. Double-click the class to open its Properties dialog.
  4. In the Class tab, type the class name (e.g. Customer). Check Abstract if the class is abstract — Dia will render the name in italics, per UML convention.
  5. Click OK.

Step 3: Add Attributes and Operations

With the class selected, double-click it again to reopen Properties:

  1. Go to the Attributes tab and click New. Enter the attribute name (e.g. email), its type (e.g. String), and its visibility (see the table below).
  2. Go to the Operations tab and click New to add methods (e.g. placeOrder()), with parameters and return types.
  3. Use the Up/Down buttons to order attributes and operations sensibly.

Visibility symbols in Dia

Symbol Meaning Dia setting
+ Public Visibility: Public
- Private Visibility: Private
# Protected Visibility: Protected
~ Package Visibility: Package

Step 4: Connect Classes with Relationships

The UML sheet provides a separate tool for each relationship type — pick the right one from the Toolbox instead of drawing plain lines:

Toolbox tool UML meaning Visual Example
Association A uses / knows B Plain line Customer — Order
Aggregation Weak “has-a” (shared) Hollow diamond Team ◇— Player
Composition Strong “has-a” (owned) Filled diamond House ◆— Room
Generalization Inheritance Hollow triangle Dog —▷ Animal
Dependency Uses temporarily Dashed line Report – -> Printer
Realization Implements interface Dashed + hollow triangle Class – -▷ Interface
  1. Select the relationship tool, then click the first class — small crosses appear. These are connection points.
  2. Click a connection point on the first class, then a connection point on the second class. The line snaps and stays glued: move either class and the connector follows.
  3. Double-click the connector to set its name, multiplicity (e.g. 1..*), and role labels.
Green vs. red handles: When you drag a connector endpoint, a green cross means it is properly attached to the object; red means it is floating free. Always aim for green so your diagram survives rearranging.

Step 5: Add Interfaces (Lollipop Notation)

  1. Select the Interface tool and click the canvas — Dia draws the lollipop (circle on a stick).
  2. Double-click it to name the interface (e.g. Payable).
  3. Connect implementing classes with the Realization tool, or draw the lollipop directly attached to the class edge.

Step 6: Annotate with Notes

Use the Note tool (the dog-eared rectangle) for explanations, constraints, or TODO markers. Connect a note to a class with a dashed line to show what the comment refers to. Notes do not affect the UML semantics — they are documentation for humans.

Step 7: Tidy the Layout

  • Snap to grid: enable View > Show Grid and View > Snap to Grid to align boxes neatly.
  • Zoom: use View > Zoom or Ctrl + mouse wheel. Work at 100–150% for precise placement.
  • Layers: for large diagrams, open View > Layers (F3) and put background annotations on a separate layer you can hide.
  • Consistent sizing: keep class boxes roughly the same width; Dia does not auto-resize, so eyeball it with the grid.

Step 8: Save and Export

  1. Save your work with File > Save as a .dia file (Dia’s editable format — always keep this).
  2. For sharing, use File > Export: SVG for crisp scaling in documents and web pages, PNG for slides and chat, PDF for print.

See our detailed guide: How to Export High-Quality Images from Dia.

Want to learn UML properly? Dia handles the drawing; understanding the notation is a separate skill. If you want a structured course on UML and software design, reputable online learning platforms offer beginner-to-advanced UML courses — worth considering once you outgrow trial and error. (We will add specific recommendations once our course partnerships are live.)

Worked Example: A Small Library System

Theory sticks better with a concrete example. Let’s model a tiny library system with four classes — follow along in Dia:

  1. Classes: place four Class objects and name them Book, Member, Loan, and Librarian.
  2. Attributes: give Book the attributes isbn: String (private), title: String (public), available: Boolean (private). Give Member memberId: String (private) and name: String (public).
  3. Operations: add borrow(member: Member): Boolean to Book, and register(): void to Member.
  4. Associations: connect Member to Loan with an Association named makes, multiplicity 1 on the Member side and 0..* on the Loan side. Connect Loan to Book with a Composition (a loan owns its line items — if the loan is deleted, they go too).
  5. Inheritance: add a StaffMember class and connect it to Member with Generalization (hollow triangle pointing at Member).
  6. Interface: add an Identifiable lollipop and connect Book and Member to it with Realization — both can produce an ID string.

In about ten minutes you have a diagram you could put in a design document. Save it as library.dia.

Common Beginner Mistakes

  • Arrows pointing the wrong way: in Generalization, the hollow triangle points at the parent (the more general class). In Dependency, the dashed arrow points at the thing being used.
  • Overloading one diagram: a class diagram with 40 classes is unreadable. Split by subsystem and use Notes to cross-reference.
  • Forgetting multiplicity: an association without multiplicity is ambiguous — always label both ends, even if it is just 1 and *.
  • Modeling the database, not the domain: class diagrams show concepts and responsibilities; foreign keys belong in your ER diagram, not here.
  • Floating connectors: if moving a class leaves its lines behind, you connected to the canvas (red handles). Reconnect to the green connection points.

Dia for UML: Honest Strengths and Limits

Dia is an excellent drawing tool for UML, but it is worth knowing where it stops so you pick the right tool for the job:

  • Strengths: free forever, offline, fast on old hardware, correct core notation, clean SVG/PDF export. Perfect for documentation, coursework, whiteboard-style design sessions, and open-source projects.
  • Limits: no model validation (Dia won’t warn you about an illegal UML construct), no XMI import/export, no code generation, no real-time collaboration. Large models (100+ classes) become hard to navigate without a model browser.
  • When to upgrade: if your team needs simultaneous editing, Jira/Confluence integration, or round-trip code synchronization, that is genuinely what commercial UML tools are for. Many teams sketch in Dia and formalize in a heavier tool later — a perfectly respectable workflow.

Frequently Asked Questions

Can Dia draw UML sequence diagrams too?

Yes. The UML sheet also includes sequence-diagram objects (lifeline, call/message arrows). The workflow is the same: select the sheet, place objects, connect them. Class diagrams are the most common use, but state charts and activity diagrams are supported as well.

Is Dia good enough for professional UML work?

For documentation, teaching, and design sketching, absolutely — it covers the core UML notation correctly. What it lacks compared with commercial tools is team collaboration, model validation, and code generation. If you need real-time multi-user editing or round-trip code sync, that is the point where a paid tool earns its keep.

Can I import UML from another tool into Dia?

Dia does not import XMI (the UML interchange format), so there is no automatic conversion from tools like Enterprise Architect. You will redraw the diagram — but for most class diagrams this takes minutes, and you get a clean, editable .dia file.

How do I show generics/templates like List<T>?

In the Class properties there is a templates/parameters section where you can declare type parameters; Dia renders them in the dashed box at the top-right of the class, per UML convention.

My connectors keep detaching when I move classes. How do I fix it?

You connected to the canvas instead of the object. Delete the connector, re-select the relationship tool, and make sure you click directly on the green connection crosses of each class. Red handles mean “not attached”.

Where can I ask more Dia questions?

Check our general Dia FAQ — it covers installation, HiDPI fixes, XQuartz on Mac, and more.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *