UML diagrams - which diagram to use and why

By Kymberly Fergusson

The Unified Modeling Language (UML) is a diagramming notation (language) that lets you visualize systems and software. It’s one of the most popular forms of diagramming in software development and became an ISO standard in 1997. Since then, there have been a few updates to add extra UML diagram types and to support new technologies in programming.

There are two main categories and 14 different types of UML diagrams, each of which is used in a different situation.

UML Diagram

Use case diagrams in UML are used during the requirements phase of software development – they usually put the system requirements into a diagram format, and it’s easy to see what actions a system must support at a glance. Of course, there will be many use cases for your system, and therefore you will usually need to draw many use case diagrams!

Along with other UML diagrams, such as activity, sequence and component diagrams, use case diagrams help you to visualize your software and requirements, before jumping in and starting to program.

Use Case Diagram

The Unified Modeling Language or UML notation is probably the most well known and regularly used visual representation of programs that you’ll find in software development. There are a wide range of diagrams to help you specify your data and processes before you start programming. They help you clarify requirements and limitations, speed up the implementation, provide a guide for thorough testing, and prevent bugs from sneaking in throughout the entire software development process.

Classes: Each class is represented by a box with three sections stacked on top of each other with the following formatting. Only the class name is mandatory

Associations: When a link exists between classes you can indicate it in a number of ways.

Class Diagram

UML sequence diagrams are the first highly detailed behavioural diagrams that you will create when using UML for software development. They aren’t so often used in business process modelling, especially because they refer to the actual data and operation names that will be used when programming. That doesn’t mean you can’t use sequence diagrams: they can be used to model business objects and their interactions in detail, or by IT staff to detail how the elements in their infrastructure communicate and work together.

Sequence diagrams take the classes with their data and operations, plus the general behavior modeled in the activity diagrams, and show how it all fits together. Apart from parts of the actual interface, you could write your program from the combination of the class and sequence diagrams!

Sequence Diagram

Like use case diagrams, activity diagrams model the behaviour of users and systems as they follow a process. They are a type of flow chart or workflow, but they use slightly different shapes.

Activity diagram

State diagrams diagrams have been used in programming to describe the various possible states that a system can be in for decades. They also quickly show which states lead to each other, and what triggers a change of state.

The biggest difference between state diagrams and activity or interaction overview diagrams is that state diagrams do not (necessarily) show the sequence. They just show what states are possible and their entry and exit points, not when those states are entered.

Components of UML state diagram

State Diagram

These UML diagrams are a combination of an activity diagram and sequence diagrams. Each individual activity or interaction is placed in its own frame, making it easier to see the different paths that need to be programmed when there are complex if-then-else decisions. Decisions are outside of the frames to show the flow of control between the various interactions.

The interactions themselves, inside the frames, are very similar to sequence diagrams. Between the interactions you will have decisions (diamonds) and fork and join nodes (solid horizontal rectangles), and connectors to show the flow of control. There are also initial and final nodes to show the start and end of the overarching interaction.

Interaction overview diagram

My Bitcoin Calculator

BitCoin Diagram