How to Recognize the Antipattern
Though you might think that it’s difficult to spot code when it is missing, modern IDE products highlight code when it ignores a function’s return value, or neglects to handle a checked exception. You might also recognize the See No Evil antipattern from the following phrases:
-
“My program crashes after I query the database.”
Often the crash happens because your query failed, and you tried to use the result in an illegal manner, such as calling a method on a nonobject or dereferencing a null pointer.
-
“Can you help me find my SQL error? Here’s my code...”
First, start by looking at the SQL, not the code that builds it.
-
“I don’t bother cluttering up my code with error handling.”
Some computer scientists ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access