in reply to OOP style question: Checking a value
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OOP style question: Checking a value
by spq (Friar) on Aug 29, 2006 at 21:42 UTC |