A New Kind of Exception

This is my go to considered harmful ((Totally working at the university Edsgar Dijkstra was working at when publishing that letter.)), my object orientation ((Totally talked with Kristen Nygaard.)), my data encapsulation ((Totally sat next to and discussed with David Parnas over beers at a conference dinner.)).

I give you the ImTiredOfThinkingException. Whenever you are too lazy to think things thru, simply throw an exception and move on to shinier things. I’ve even made it an unchecked exception, so I won’t have to worry about catching and handling it.

Here’s an example of its use:
[java] List<Pair<Pair<Set<AP>, Set<AP>>, Node<AP>>> cloneList = transitions.get(clone);
if (cloneList == null) {
cloneList = new ArrayList<Pair<Pair<Set<AP>, Set<AP>>, Node<AP>>>();
transitions.put(clone, cloneList);
} else {
throw new ImTiredOfThinkingException(
“This most likely shouldn’t happen, but a have a feeling it might. ” +
“If so, nodes created by splitting other nodes should probably be tagges. ” +
“I suppose.”);
}
[/java] You too can reduce the tediousness of thinking before coding.  Here is a simple implementation of the exception, usable in any project:
[java] public class ImTiredOfThinkingException extends RuntimeException {
private static final long serialVersionUID = 1L;

public ImTiredOfThinkingException(final String message) {
super(message);
}
}
[/java]

Also, it totally shouldn’t be an exception…

One thought on “A New Kind of Exception

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.