plantuml
One resource to revisit when you see sloppy PlantUML diagrams is this StackOverflow question.
ERD Diagrams
plantuml
is a bit much to get going. You need to install java, you need
to download the plantuml.jar file, and you need to set the
org-plantuml-jar-path
variable.
ERD diagrams are doable in plantuml, but you cannot (that I know of) link fields to one another. It might be good to generate an ERD with a full field listing for an overall view, and then another diagram that spells out field linkages.
First, we set the path to plantuml.jar
(setq org-plantuml-jar-path '"~/windows/plantuml/plantuml.jar")
Then we define our diagram
skinparam monochrome true
skinparam shadowing false
hide circle
hide empty members
title All Fields
entity email {
* pkid
* email2user
* email
}
entity user {
* pkid
--
* username
first
last
}
entity phone {
* pkid
* phone2user
* phone
}
email}-||user
user||-{phone
Now we define our linkage:
skinparam monochrome true
skinparam shadowing false
hide circle
title Foreign keys
entity user {
* pkid
}
entity email {
* email2user
}
entity phone {
* phone2user
}
email}-||user
user||-{phone
Even with only one field, the crows feet don’t line up perfectly, but at least you get to see the relationships.
Sequence Diagrams
You can also do sequence diagrams
skinparam monochrome true
Foo -> Bar: synchronous call
Foo ->> Bar: asynchronous call
Use case diagrams
And use case diagrams:
left to right direction
skinparam monochrome true
skinparam shadowing false
skinparam packageStyle rect
actor customer
actor clerk
rectangle checkout {
customer -- (checkout)
(checkout) .> (payment) : include
(help) .> (checkout) : extends
(checkout) -- clerk
}
class diagrams
You can build class diagrams:
skinparam monochrome true
skinparam shadowing false
interface Command {
execute()
undo()
}
class Invoker{
setCommand()
}
class Client
class Receiver{
action()
}
class ConcreteCommand{
execute()
undo()
}
Command <|-down- ConcreteCommand
Client -right-> Receiver
Client --> ConcreteCommand
Invoker o-right-> Command
Receiver <-left- ConcreteCommand
and more
There are many diagrams you can create with plantuml. You can see examples and example source code and real-world-plantuml.com.