Exception-free variant of PingManager.ping(Jid)

Issue #15 closed
Markus KARG created an issue

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)

  1. Log in to comment