Skip to main content
fixed grammar
Source Link

I would also like to mention the idea of Command Query Separation

Ideally,

  • Queries return a result (and don't have side-effects)
  • Commands change the state of a system.

As it seems to me that your methods andare essentially commands, I would have them have a void return signature and raise exceptions on errors.

Than again, even if your queries encounter errors, they too should raise exceptions and not "return" something indicating a errorsan error. Programmers sometime use null to signify that a query failed, but I think that is ill advised.

I would also like to mention the idea of Command Query Separation

Ideally,

  • Queries return a result (and don't have side-effects)
  • Commands change the state of a system.

As it seems to me that your methods and essentially commands, I would have them have a void return signature and raise exceptions on errors.

Than again, even if your queries encounter errors, they too should raise exceptions and not "return" something indicating a errors. Programmers sometime use null to signify that a query failed, but I think that is ill advised.

I would also like to mention the idea of Command Query Separation

Ideally,

  • Queries return a result (and don't have side-effects)
  • Commands change the state of a system.

As it seems to me that your methods are essentially commands, I would have them have a void return signature and raise exceptions on errors.

Than again, even if your queries encounter errors, they too should raise exceptions and not "return" something indicating an error. Programmers sometime use null to signify that a query failed, but I think that is ill advised.

Source Link

I would also like to mention the idea of Command Query Separation

Ideally,

  • Queries return a result (and don't have side-effects)
  • Commands change the state of a system.

As it seems to me that your methods and essentially commands, I would have them have a void return signature and raise exceptions on errors.

Than again, even if your queries encounter errors, they too should raise exceptions and not "return" something indicating a errors. Programmers sometime use null to signify that a query failed, but I think that is ill advised.