Timeline for Check for Palindrome string in Java
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 24, 2016 at 17:42 | comment | added | Timothy Truckle |
@Blindman67 "To use exceptions to avoid conditional statements?" No, that was not my statement. I use Exception to avoid checking error conditions in the "happy path". This does not mean that I don't use if statements at all.
|
|
| Nov 24, 2016 at 16:26 | comment | added | Blindman67 | To use exceptions to avoid conditional statements? You are building a bridge to get over a gate. Exceptions are not an alternative to normal logic flow and adds unneeded complexity where not required. Good validation should never need to throw an exception. Exceptions are to handle what is beyond the reach of the code, the very last option when all other possibilities are exhausted. Sorry without a good reason for the throw your answer is not good advice -1 | |
| Nov 24, 2016 at 14:48 | comment | added | Timothy Truckle |
@Blindman67 "You should always be looking for ways to minimise the use of exceptions and exception handling code" hwat is the consequence og not using exceptions here? It will result in return code checks (if(isValid) then ... ) in the calling method. That is exactly the situation to be avoided and why we (except you ;o)) use exceptions.
|
|
| Nov 24, 2016 at 13:53 | comment | added | Blindman67 | I could not disagree more with your use of a throw to do a basic vetting operation. You should always be looking for ways to minimise the use of exceptions and exception handling code, and you certainly should not be using expectations to pass expected information back to the method's caller. | |
| Nov 24, 2016 at 12:35 | history | answered | Timothy Truckle | CC BY-SA 3.0 |