Timeline for Limits of Defensive Programming acknowledging that Exception Handling should be avoided
Current License: CC BY-SA 4.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 17, 2018 at 7:46 | comment | added | Lefteris008 |
(2/2) Can I create an if-else condition that has 15 members to validate and still be more efficient than a more shorter version with three members and encased into a try-catch ?
|
|
Sep 17, 2018 at 7:44 | comment | added | Lefteris008 |
(1/2) From the examples I've provided, you can see that I am parsing five fields that come externally from a middleware call (code not available for that). Middleware is not handled by me, so it is possible that each one of them could be null . Trying to perform an equality check with a null on C#, throws an exception. So, either I create a much more complex if-else statement that removes this possibility, or I simplify it and encase it in a try-catch statement. My question is more general: where if-else performance advantage ends over a try-catch ?
|
|
Sep 17, 2018 at 7:41 | history | answered | Kilian Foth | CC BY-SA 4.0 |