Welcome to the world of PlantUML! With this quick start guide, you'll be creating your own diagrams in no time. Whether you're drawing a class diagram or creating a use case, PlantUML makes it simple and intuitive.
Introduction to PlantUML
PlantUML is a tool that allows you to create UML diagrams using a simple and intuitive language. It uses plain text to describe the desired diagram, which means you can focus on the structure and content, and leave the drawing part to PlantUML.
The basic structure of the PlantUML language consists of @startuml and @enduml tags at the beginning and end of your code respectively. These tags mark where the description of your diagram begins and ends.
Creating Diagrams
Class Diagrams
Class diagrams represent the static structure of a system, including its classes, their attributes, methods, and relationships among objects.
Here's an example of a simple class diagram:
@startuml Class01 <|-- Class02 Class03 *-- Class04 @enduml | We've encountered an issue exporting this macro. Please try exporting this page again later. |
In this example, Class01
is connected to Class02
using a simple inheritance, represented by <|--
, and Class03
is connected to Class04
using composition, represented by *--
.
Use Case Diagrams
Use case diagrams help visualize the interactions between systems and entities (external actors) in terms of use cases.
Here's a simple use case diagram:
@startuml User -- (Create) User -- (Edit) @enduml | We've encountered an issue exporting this macro. Please try exporting this page again later. |
In this example, User
is an actor that interacts with the system to Create
and Edit
.
Sequence Diagrams
Sequence diagrams show interactions between classes in a sequential order. They illustrate objects, classes, and their interaction throughout the sequence.
Here's an example of a sequence diagram:
@startuml Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response @enduml | We've encountered an issue exporting this macro. Please try exporting this page again later. |
In this example, Alice
sends an Authentication Request
to Bob
, and Bob
sends an Authentication Response
back to Alice
.
Adding Labels and Notes
Labels
You can label the relationships between classes. For example:
@startuml Class01 "1" *-- "many" Class02 : contains @enduml | We've encountered an issue exporting this macro. Please try exporting this page again later. |
Here, Class01
has a one-to-many relationship with Class02
and is labeled contains
.
Notes
To further explain certain parts of your diagram, you can add notes:
@startuml Class01 <|-- Class02 note right: This is a note on the right. @enduml | We've encountered an issue exporting this macro. Please try exporting this page again later. |
This will add a note on the right side of your diagram, containing the text This is a note on the right
.
Viewing your diagram in Confluence
Enter your PlantUML code into the field provided by the PlantUML for Confluence app. Once you're done, PlantUML for Confluence will automatically generate and display your diagram on your Confluence page.
That's it! You are now ready to start creating your own UML diagrams using PlantUML. As you continue to explore and become more familiar with it, you'll discover the full range of its capabilities. Happy diagramming!