Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 840 Bytes

File metadata and controls

31 lines (20 loc) · 840 Bytes

Diaper Pattern

SmartMirror Group

How to recognize Diaper Pattern:

When you have a Try-Catch for an error, but you have no implementation of what should happen
when an error is caught.

Example:

try: 

do_something_that_might_throw_exception()
except Exception:
	pass

As you can see, the exception is not handled, logged, or notifies the user of such exception.

(found from The Diaper Pattern Stinks)

Why Diaper Pattern is considered harmful:

You would not know what is happening in the background of your program. It might range from memory leaks to simple errors and warnings.

Solution:

At the very least, log the exception, notify the user, or insert code that will handle the issues at run-time.