How to Create a UML Class Diagram Using MS Word

Although Microsoft Word is not a full-featured diagramming application like Visio, it has the tools you need to create UML or Unified Modeling Language models for your software projects. Word text boxes can be used to hold the name, attributes and operations for each class in your program. Unlike normal word processor text, information within text boxes can be precisely placed anywhere within your document. You can also use Word's Shape Tools to draw connecting lines between two classes to show their association or relationship.

Young Man Working on PC
UML diagrams help programmers think through their project's logic and data flow before writing code.
credit: Zeynep Özyürek/iStock/Getty Images

Step

Open a blank Word document to contain your UML diagram.

Step

Insert a simple text box into the document to hold your first class. Click "Insert," "Text Box" and then "Simple Text Box." Delete the default text within the new text box.

Step

Enter the name of your first class and then press "Enter." For example, if you are designing a clothing store inventory program, you could have a class named “Pants.”

Step

Add a horizontal line to separate the name from the rest of the class components. Press the "-" key several times and then "Enter."

Step

Add all the attributes belonging to the first class beneath the horizontal border. For example, if you are creating a class for a clothing store inventory program, the “Pants” class could have variables for style, material, length, season and gender.

Step

Create another horizontal line beneath the last attribute by pressing "-" several times and then "Enter."

Step

Add all class operations beneath the new horizontal line. For example, the “Pants” class may have a method "ShowStyles" that returns the number of pant styles in inventory.

Step

Add standard notation in front of each class attribute and operation to denote its visibility to the rest of the application. Type "+" for public, "-" for private, "#" for protected or "~" for package in front of the class component name. For example, type "-ShowStyles" to designate this method as private.

Step

Create additional text boxes to contain the rest of the classes your program will need.

Step

Move the class text boxes in their proper location within your diagram. Click and hold down the mouse button on a text box border, drag the box to its desired location and then release the mouse button.

Step

Draw lines or connectors to show the relationship between your classes. Click "Insert," "Shapes" and then the type of line you need. For example, a line with a single arrow head shows a directed or unidirectional association between two classes. A plain line with no arrow heads depicts a bidirectional relationship between classes.