- changed status to resolved
Exception-free variant of PingManager.ping(Jid)
Issue #15
closed
Exceptions should only happen in case something really exceptional (hence: unexpected) happens. The sense of a ping(Jid) is to know whether or not the chat partner's software still is online. The outcome is expected to be "false" more often than not. Hence, from a design view, ping(Jid) should not throw an exception but instead return a boolean.
BTW, also, from a technical aspect, exceptions should never be used for expected results, as they imply more computational overhead that "normal" results: A result just pops the stack. An exception instead puts new information (the exception object) on the stack. So unless the outcome really is exceptional, it shouldn't be an exception. :-)
Comments (3)
-
repo owner -
repo owner - changed status to closed
-
repo owner - changed version to 0.5.0
- Log in to comment
Well, that could still be arguable... Receiving no response is an exceptional case, too, no!?
Changed that with 8e0bc240e10774b95ad7dfc3e5b3735366538b12
Downside is, that the caller now can't know if the peer supports the ping protocol or not, but I think that's acceptable.