Library
As you begin to describe more architectures within your team, the number of diagrams will grow. Additionally, many of these diagrams will share some architectural elements.
While diagrams-as-code is a powerful approach, it also introduces some common pitfalls of software development, such as code duplication.
Consider the following scenario:
"Your team reuses an important architectural element (e.g., a CDN) across all systems. As a consequence, the same PlantUML code of this architectural element is included in many of your diagrams. At a certain point, your team decides to change the technology of this architectural element, requiring you to update all the diagrams."
This scenario introduces several problems:
- Manual Refactoring: Duplicated code necessitates manual refactoring to update all occurrences whenever a change is required.
- Inconsistent Diagrams: Manual refactoring is prone to errors. You might accidentally skip some occurrences, resulting in an inconsistent description of the architecture.
- Low Productivity: Manually recreating parts of a diagram multiple times can slow down your work.
And this is where the Mina Library comes in with the following features:
- Elements Reuse: Create an element in the library and simply import it into your diagrams.
- Diagrams Synchronization: If you need to change a reused element, update it in the library. Mina will automatically synchronize all the diagrams with the updated data.
Usage
Creating an element in the library
- Click on the library icon () in the sidebar
- Select the type of the C4 element you want to create
- Click on the create button at the top-right
- Fill the form with the required info
- Click on the save button
Importing a library element in a diagram
- Open a diagram
- Place the cursor at the line of the code editor where you want to add the PlantUML code of the library element
- You have two options:
- Right mouse click -> "Import from the library"
- Click on the icon in the toolbar of the editor
- In the dialog, select the C4 element type to import from the library
- Select the element from the table
- The dialog will close, and the PlantUML code of the selected element will be added in the code editor
Modifying a library element
Mina will synchronize all diagrams that import the modified element with the updated data.
- Click on the library icon () in the sidebar
- Select the type of the C4 element you want to modify
- You have two options:
- Click on the row of the element you want to modify
- Click on the icon ... and then open
- Modify the element
- Click on the save button
- Mina will synchronize all diagrams that import the modified element with the updated data
Deleting a library element
Mina will not remove the deleted element from the diagrams that import it. The element will be removed just from the library.
- Click on the library icon () in the sidebar
- Select the type of the C4 element you want to delete
- Click on the icon ... and then delete