A New Kind of Exception
This post has 245 words. Reading it will take approximately 1 minute.
loading...
This is my go to considered harmful1), my object orientation2), my data encapsulation3).
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:
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.");
}
You too can reduce the tediousness of thinking before coding. Here is a simple implementation of the exception, usable in any project:
public class ImTiredOfThinkingException extends RuntimeException {
private static final long serialVersionUID = 1L;
public ImTiredOfThinkingException(final String message) {
super(message);
}
}
Also, it totally shouldn’t be an exception…
A New Kind of Exception,









1 Comment on "A New Kind of Exception"
Trackback | Comments RSS Feed
Inbound Links