Sunday, February 23, 2003


No JSR necessary.

System.debuggerBreak(). In my halcyon days of C++, there was a useful idiom we used a lot as part of our debugging and diagnostic suite of code tricks. The idea was that there were certain parts of the code that, if we hit them, we immediately wanted the debugger, if running, to break on. We did it more or less like the following: [The Mountain of Worthless Information]

public class BreakMe extends RuntimeException {
public static boolean breaksActive;
public static debuggerBreak() {
   if (breaksActive) {
      throw new BreakMe();
   }
}

Then just set a debugger exception breakpoint that fires on BreakMe.  Every Java debugger I'm aware of supports this.  Which leads to a rant:

Are you one of this idiot library coders who tests for the end of an array by waiting for ArrayIndexOutOfBounds?  Or do you test the existence of something by catching NullPointerException?  I hate you.  You make me nuts.  I don't want your code throwing an exception during its normal run.  Some of the Apache stuff is guilty of this and it drives me nuts.  I don't give a crap if you saved 0.0234 ms during a routine.  You screwed up my ability to debug code.

My code never throws exceptions during the normal course of a run.  Yours shouldn't either, especially if it's a library and you expect rational human beings to use it.

 


11:32:06 AM    

Overreactions.

Tom Friedman wonders if we are.  Yes, we are.  This has been a real week of disasters -- two club fires, crazy weather, buildings collapsing...every once in a while Joe America needs to pull out his pocket calculator and figure out where the real dangers in his life come from.  Let's see -- probability wise, the most dangerous thing you do each day is get in your car and drive to work.  44,000 people die each year in automobile accidents, and a hell of a lot more than that get injured.  These kinds of problems have become routine, though.  9/11 was bad, yes, but more people die each month on the roads than died in 9/11.  Heart disease can kill ya. 

Terrorism punctured our juvenile illusion of invulnerability as a society.  The thing to remember is, we didn't lose anything.  We've always been in danger; we just forgot about it for a long time. 

Do you want to overreact?  Those people in Chicago are dead because they thought they were in a terrorist attack, and there was panic.  I think it is fundamentally irresponsible of our current government to be engendering (even if through good intent) such an atmosphere of fear and distrust.  There are bigger, scarier things out there than terrorism.  They're the things that live in your everyday life, and they're far more likely to hurt you or kill you than an Islamic idiot on drugs.


7:32:31 AM    

Rule Stuff.

Expert Systems: Principles and Programming - Giarratano.

That's THE rules engine book -- covers CLIPS extensively and gets into the heart of things nicely.  A little dry at times, though.  I'm looking forward to Norvig's new book too.

Some other projects of interest include Lisa (LISP Rete) by David Young.  Xanalys has their KnowledgeWorks product, which I'd love to get my hands on...see what I can do with combined forward and backward chaining.

I highly recommend reading papers on TREAT networks and Gator networks.  I spent a bunch of time trying to figure out how to dynamically optimize Gator networks last week -- it's a tough problem.


6:37:58 AM