I am learning about SOLID principles in a Pluralsight course where Command Query Separation is being discussed. I am fine with the query functions returning something (and crucially being non-mutating).
The question I have is about commands. The idea here is that commands should return void. What if there is a problem executing the command? Some functions that might be mutating return a result code. This idiom is quite common in C programs. So how to address that.
Do you have to assume that these functions should always succeed? Or should it raise an exception if the function does not succeed?
How would you handle it if the language doesn't support exceptions, eg C?