A few days ago, I along with my friend went to the restaurant. When I went to use a washroom, I found these symbols on the doors.
I realized the humor of the designer and then I went to the Male washroom. However, I observed that other people who don’t understand the humor, having difficulty to understand the correct washroom. They had to ask staff for help. Hmm! That’s not that user-friendly.
Similarly, people try to be too clever while writing the code.
Please see the above code snippet. Do you understand the intent of BombDetector.Detect? Original author must have tried to use his humor while writing the code.
However, the maintenance developer may not understand the humor behind it and he would feel helpless to understand the intent.
The original author was checking the value of the input argument and throwing the exception if a value of an argument is null.
Above snippet could have been kept simple.
Try to keep your code as simple as possible so that everyone could easily understand it and easily work with it.
Image source: https://quotefancy.com/quote/1469345/Billy-Wilder-Don-t-be-too-clever-for-an-audience-Make-it-obvious-Make-the-subtleties