2/1/2022

Github Sequence Diagram

  1. Sequence-diagram · GitHub Topics · GitHub
  2. Cached
Github Sequence Diagram

Draw Go module provides SVG rendering features focusing on creating software design diagrams.

Why?
Let programmers do what they are good at. By providing an API, creating diagrams is no different from other programming.
Speed; once you know the API programming a sequence diagram is actually much faster than drawing it by hand.
Keep uptodate; diagrams describe software, which moves fast. Keeping diagram in sync is a tedious task if manually drawn. Being code, they are refactored with the same tools as the rest of the code and in most cases with little or no extra effort.

Sequence-diagram · GitHub Topics · GitHub

I think that GitHub or GitLab are good places to publish this. To publish the UML diagrams, I would like to have some easy way to keep them updated into the repository and visible as images in the wiki. I don't want to keep the diagrams in my computer (or on the cloud), edit them, generate an image, and then publish it every time. UML provides neither notation to model exception handling in sequence diagrams nor any reasoning why it is absent. Some clumsy approaches to model try-catch blocks are by utilizing combined fragments - alt (alternatives) and breaks, while adding stereotypes for reply messages representing thrown exceptions. See full list on github.com. Sequence Diagram Online Editor. Loading My Diagrams Library GitHub.

Install

API documentation

  • draw/shape - SVG shapes
  • draw/design - software design diagrams

About

Written by Gregory Vinčić
MIT License


Quick start

Each diagram is a Go type specifically designed to provide an easy and intuitive way of 'programming' diagrams. Elements are either fixed strings or taken from the source code by using concrete instances of real types. This is what makes refactoring update diagrams aswell.
Once you selected elements to include in your diagram place them out and position them relative to each other. Relative placement has the benefit of adaptive diagrams once you add more methods or fields to your structs.


Once a diagram is done, you can render the SVG in different ways

  • SaveAs(filename)
  • Inline() - returns SVG as string with all classes replaced with styling
  • WriteSVG(io.Writer)

These pages for instance are generated using the github.com/gregoryv/web package using the Inline() method and looks something like the below code

Styling is currently provided by draw.ClassAttributes and can be changed to some degree. For now font size and family should not be changed as size of shapes will not adapt to the styling values. The idea is however that the default styling should be left alone.

There are more design diagram types available, take a look and do let me know if you are missing something that could benefit the community.

Diagrams

Class

In class diagrams the author wants to convey design relations between various entities. However the relations and most of the element naming can be generated from the source code. The author should add what is needed for a clear picture, ie. selecting entities to show and position them in a perceptible manner.


Source: class_example.go

Records describe each entity using package name and type. Methods and fields are shown only by name if visible. Details such as arguments and return values are left to the API documentation. Relations are automatically rendererd between entities if there is one.

Activity


Sequence

Sequence diagrams are ment to describe a sequence of events, specifically calling methods or remote API calls. I've tried to emphasize the horizontal arrows over vertical lines and keep visual effects to a minimum. For now there is only one arrow variation. I found that embedding information by the subtle head variations and arrow line styling is hard to read.


Gantt chart

Cached

Github sequence diagram example

Generic

Shapes

Changelog

License