C4InterFlow icon indicating copy to clipboard operation
C4InterFlow copied to clipboard

Improve Sequence Diagrams

Open SlavaVedernikov opened this issue 3 months ago • 0 comments

Context

  • Sequence diagrams for Business Processes have Group boxes per Activity as well as per cross-participant interactions. This make diagrams a bit too busy.
  • C4 Sequence Diagrams do not have participant at the bottom of the diagram (footer), which makes it difficult to read long diagrams.
  • Sequence diagrams have Group boxes per cross-participant interactions that display Interface Labels only. It's not clear from that which participant exactly is being called

Here is an example of the current PlantUML code for C4 Sequence diagram

@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Sequence.puml

title Manage Accounts - C4 Sequence - Container level)

Person(TraderX.Actors.Trader, "Trader", "")

System_Boundary(TraderX.SoftwareSystems.TraderX, "TraderX")
    Container(TraderX.SoftwareSystems.TraderX.Containers.WebClient, "Web Client", "", "Browser based web interface for TraderX")
    Container(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Web GUI", "", "Allows employees to manage accounts and book trades")
    Container(TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Accounts Service", "", "Service which provides account management")
    Container(TraderX.SoftwareSystems.TraderX.Containers.PositionService, "Position Service", "", "Server process which processes trading activity and updates positions")
Boundary_End()

group Trader - View Account
Rel(TraderX.Actors.Trader, TraderX.SoftwareSystems.TraderX.Containers.WebClient, "View Account")
group View Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Load Account")
group Load Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Get Accounts")
end
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Load Trades For Account")
group Load Trades For Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.PositionService, "Get Trades For Account")
end
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Load Positions For Account")
group Load Positions For Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.PositionService, "Get Positions For Account")
end
end
end

group Trader - Create Account
Rel(TraderX.Actors.Trader, TraderX.SoftwareSystems.TraderX.Containers.WebClient, "Create Account")
group Create Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Create Account")
group Create Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Create Account")
end
end
end
group Trader - Update Account
Rel(TraderX.Actors.Trader, TraderX.SoftwareSystems.TraderX.Containers.WebClient, "Update Account")
group Update Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Update Account")
group Update Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Update Account")
end
end
end

@enduml

...which renders as follows:

image

Requirements

  • Sequence diagrams for Business Processes must have Divider or separator per Activity.
  • C4 Sequence Diagrams must have participant at the bottom of the diagram (footer).
  • Group boxes per cross-participant interactions in Sequence diagrams must have the full Interface path like so: <Software System> - [<Container>] - [<Component>] -<Interface Label> e.g. TraderX - Web GUI - View Account

Here is an example of how PlantUML code for C4 Sequence diagram should look:

@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Sequence.puml

SHOW_FOOT_BOXES()

title Manage Accounts - C4 Sequence - Container level)

Person(TraderX.Actors.Trader, "Trader", "")

System_Boundary(TraderX.SoftwareSystems.TraderX, "TraderX")
    Container(TraderX.SoftwareSystems.TraderX.Containers.WebClient, "Web Client", "", "Browser based web interface for TraderX")
    Container(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Web GUI", "", "Allows employees to manage accounts and book trades")
    Container(TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Accounts Service", "", "Service which provides account management")
    Container(TraderX.SoftwareSystems.TraderX.Containers.PositionService, "Position Service", "", "Server process which processes trading activity and updates positions")
Boundary_End()

== Trader - View Account ==
Rel(TraderX.Actors.Trader, TraderX.SoftwareSystems.TraderX.Containers.WebClient, "View Account")
group TraderX - Web GUI - View Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Load Account")
group TraderX - Accounts Service - Load Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Get Accounts")
end
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Load Trades For Account")
group TraderX - Position Service - Load Trades For Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.PositionService, "Get Trades For Account")
end
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Load Positions For Account")
group TraderX - Position Service - Load Positions For Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.PositionService, "Get Positions For Account")
end
end

== Trader - Create Account ==
Rel(TraderX.Actors.Trader, TraderX.SoftwareSystems.TraderX.Containers.WebClient, "Create Account")
group TraderX - Web GUI - Create Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Create Account")
group TraderX - Accounts Service - Create Account - Create Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Create Account")
end
end

== Trader - Update Account ==
Rel(TraderX.Actors.Trader, TraderX.SoftwareSystems.TraderX.Containers.WebClient, "Update Account")
group TraderX - Web GUI - Create Account - Update Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebClient, TraderX.SoftwareSystems.TraderX.Containers.WebGUI, "Update Account")
group TraderX - Web GUI - Accounts Service - Update Account
Rel(TraderX.SoftwareSystems.TraderX.Containers.WebGUI, TraderX.SoftwareSystems.TraderX.Containers.AccountsService, "Update Account")
end
end

@enduml

...which renders as follows:

image

SlavaVedernikov avatar Mar 20 '24 09:03 SlavaVedernikov