I usually get into the task of modeling a protocol, which usually involve 3 main aspects:
- Logic: (if (cond) action 1; else action 2)
- Modules or devices: Module 1 send this message to Module 2, or client request the server.
- Data structures: The client send this data (param1, param2..) to the server.
I am not sure how to represent theses 3 element in UML in a way that the relationship is understandable.
My main question is "How to represent these 3 elements in UML, in a way that make their relationship intuitive?"
- What main diagram type to use? activity?
- How to represent modules/devices? Swimlanes?
- How to represent messages and messages structures? Object + class diagram?
- Any other suggestion?
Example
To make the question more accurate, following it is a simple protocol:
This is a protocol of synchronization between an user interface and a
server with the program logic.
=Start-up process=
The user set the communication to synchronous (the
user interface have to pull for changes every few seconds, only
possible for low usage and simple programs) or asynchronous (the server
send changes directly to the user interface)
The user also set a general purpose URL (G), that point to the server.
Async
If the communication is async, the UI request to the server for 2 URL:
* R : reception socket, to get informed about changes and update the UI
* S : sending socket, to request for get/set/change/create data in
the server.
The UI open the R socket with the server.
=Live process=
Sync:
If the communication is sync, the client ask to G any get/set/change/
create operation.
Async:
If the communication is async, the client request through S an operation.
The request contain:
* the R ip+port
* The UI element identifier to be updated (only for get operations)
* Data requiere for the operation: the request and requiered data.
The server save for every request following data:
* The user that make the request (for example the R IP+port)
* Unique reference to the UI element that will contain the data
* Unique references to the data to be returned to the client (for example
database.table.rowId.column) The user+ UI element is unique, so a new
data reference will override the old data reference. That is a way from
the server to save what each client is showing.
After any change is made on a data, the new value is sent to every user
that are showing this value through R.
=Shutdown process=
When the client close R, the server may drop/free every saved references
for this user.
-
Following it is my attempt to model it with an activity diagram: