Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of exclamation/question mark before UML method name

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

UML Class Diagram

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.

like image 657
Scriptim Avatar asked Oct 31 '25 15:10

Scriptim


1 Answers

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.

like image 149
qwerty_so Avatar answered Nov 03 '25 01:11

qwerty_so



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!