How to Create a UML Class Diagram Using MS Word

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
UML diagrams help programmers think through their project's logic and data flow before writing code.
Image Credit: Zeynep Özyürek/iStock/Getty Images

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.

Advertisement

Step 1

Open a blank Word document to contain your UML diagram.

Video of the Day

Step 2

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.

Advertisement

Step 3

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 4

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

Advertisement

Step 5

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 6

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

Advertisement

Step 7

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.

Advertisement

Step 8

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.

Advertisement

Step 9

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

Step 10

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.

Advertisement

Step 11

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.

Video of the Day

Advertisement

Advertisement

references