Functions – Exceptions Instead Of Error Codes

Maybe at some point you’ve written a function that had several possible results, and depending on the result, you had to do different things or show different error messages. One thing you might be tempted to do is have the function return a number representing the result code, or maybe the function returned an enumeration….

Continue reading

Functions – Command Query Separation

The idea of Command Query Separation is simple. You should have functions that perform actions that change the state of your system, and you should have functions that return (query) the current state of some part of the system, but your functions shouldn’t do both.  That means you should have Commands and Queries, but should…

Continue reading