As Tanktalus already explained, it feels strange to check for the response code AFTER you have called a method on an object.
In my book of programming with objects I always like the object on which a method is called to directly return some meaningful code to the caller.
It is up to the caller to either call the object in a void context (essentially throwing the return value away) or saving the return value and acting upon it later.
If you need more than a simple "true" or "false" value returned, why not go all the way and have your objects return full blown response-objects? You could make this response object stringify to one of your constants or call other methods on it (logging, stack-traces; full exception handling; ... etc).
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: OOP style question: Checking a value
by CountZero
in thread OOP style question: Checking a value
by spq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |