While it is not required, it is often seen that people put a ‘Starter’ at the far left of a sequence diagram. With ZenUML, this ‘Starter’ is hardcoded as ‘User’. Many users have complained about that:
- Sometimes ‘User’ does not make sense. A more generic name (such as ‘Starter’) could be better.
- Other users want to define their own starter — such as ‘Client’, ‘Operator’ or ‘Server’.
- ‘User’ cannot be used a normal participant.
We have a few options to define a ‘Starter’. Please let me know which one you like the best and why?
Option 1:
@Starter(User)
Controller.getBook(id) {
BookService.get(Id)
}
The default behavior should have already satisfied 80% of cases. This syntax makes the intention clear and specific. It is using a syntax looks similar to a Java annotation. Some users are already familiar with it.
Option 2:
User:Controller.getBook(id) {
BookService.get(Id)
}
// Or
User->Controller.getBook(id) {
...
This option is shorter. The :
or ->
symbol looks like User
is talking to Controller
. Cons are people can get misled that they are encouraged to use this syntax everywhere (instead of just when starting the sequence).
Option 3:
@User
Controller.getBook(id) {
BookService.get(id)
}
Similar to Option 1. Shorter but less clear. @
has become some kind of convention to mention someone. It mentions the ‘Starter’ here.
Option 4:
[User]Controller.getBook(id) {
BookService.get(id)
}
It looks more or less like the attributes in C#. I am putting it on the same line because, to me, a ‘Starter’ is NOT very important. It is there just as a complementary entity. Of course, because spaces are not important in ZenUML’s DSL, it would generate the same diagram if you put it on the above line.
I do have my own preference, but please let me hear your opinions first :)