My teacher uses exclamation marks and question marks before method names in UML class diagrams to distinguish between commands (!) and queries (?):

As I've never seen this before, I wonder whether it's actually used in practice or not and what the actual meaning is.
Basically, commands are methods that don't have a return type whereas queries are methods that do have, so I consider these symbols to be redundant. Moreover I couldn't find anything about this notation on the internet.
I'd really appreciate a clarification.
This is no official notation. Besides the fact that prefixing things which are obvious through their signature is pointless, it will just confuse readers which are not familiar with that kind of notation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With