« December 2006 | Main | February 2007 »

January 2007 Archives

January 9, 2007

Negative Testing

No, no, I'm not being Negative on testing, in fact for teh most part I am positive about testing. But what I want to talk about is a "Negative test" where the desired result is a failure. Charles Miller calls it an Anti-Test, but is sounds a little too much like the Anti-Christ. Negative Tests are a Good Thingtm and they way he describes them is almost exactly how they should be done.

In a previous job I had a rather complex bundle of code that I had the nasty habit of fixing one bug only to break something else, often that I had fixed before. This code was complex, and I often set it down for months at a time while I went and chased the latest sales demand of the week. But every so often an actual paying customer would be scheduled to bring a new shipment of code online and certain bugs QA would find that had to be fixed.

So I developed my own little test suite of code and seeded the test almost entirely with bug report tests, often negative tests. Things like "this shouldn't take more than 500ms." Creating a test case that came up red was often the first step, and for bugs where the bug repost was a positive statement, i.e. "Application Does Foo when you go Bar, Baz, Bif" I would write a test would do that, detect it. The last step was to invert the final return value, or if there were other code branches that would trap out the bug not being their, calling fail("adfadfg").

These tests can the be named something like BUG_12345_Negative to show (a) that is testing something that shouldn't be happening and also the name indicates where to look for verification. Standard fare for QA pros I am sure, but I spend most of my day oggleing over loops, xpaths, and diffs.

January 11, 2007

Null Handelers and Null References

Stephen Colebourne has published two interesting ideas that I would like to see make it into the next JDK, Null-Ignore Invocation and Null-Handlers.

The first one isn't new, Groovy has Null-Ignore Invocation but calls it Safe Navigation. The syntax Stephen proposes is to use the Sharp Hash as an operator. i.e. foo#bar() . But I much prefer the Groovy way to do it, foo?.bar() . The ? part of the operator implies to my English-centric mind that there is some question as to whether or not it will be called, and the the dot shows it is a feild or method reference.

The second idea I think is the most interesting, that of a Null handler. This is a similar Idea I came up with while daydreaming in my sophomore Data Structures classes nearly 10 years ago, but I never wrote it down or published it because I thought I'd be laughed out of academia. That was when I thought it wasn't going to take me 13 years to get a B.S., just 8 years.

The idea to me is also very elegant as well in it's implementation. I am sure there are comments that can be made about it obscuring real values of fields. And it will need to be used judiciously (as in likely not in the java.util collections framework). But it can speed up alot of standard error checking. The best part IMHO is that null handlers are they are only called when safe navigation is invoked. The programmer intended for strangeness to happen when the values are null.

This is one of the first real innovations in a while that Java can do that doesn't just steal from another language (not that it's bad, but all the time?) Too bad its coming from outside of the Ivory walls of Sun. Even with OpenJDK it's going to have to fight it's way through the JCP process to get canonized.

January 18, 2007

SWT vs. Swing comes full circle

No one can now claim that Elliotte Rusty Harold is an Eclipse Fanboy or on IBM's payroll, because he has made a very important observation that has turned the "Eclipse is better because of SWT" argument on it's ear:

The claim that SWT provides a more native looking interface than Swing is demonstrably false. In fact, exactly the opposite is true. [ Cafe au Lait ]

Just thinking about all the bytes that were expended in early 2003 still pains me. All that battle over how lousy swing was and how 1337 SWT was and how eclipse was going to destroy NetBeans in particular (the last part may be selective memory since I have been exclusively a NetBeans user since 2000, yes, nearly 7 years now!) And where are we now? NetBeans is winning awards and Eclipse isn't. There is whining about native parity on eclipse, and so many other things that are total role reversal. My how things have changed.

And really, where are we now? Parity, that's where. The whole drama lit a fire under Sun to get NetBeans in order and, especially as Sun's flagship Swing application, to get the Java Swing APIs better optimized. The project system was also revamped, and the GUI builder went under significant renovations, and the major push to get usable JavaEE integration came after that. In short, competition motivated the IDE space in Java to get better. Wether you are an Eclipse user or a NetBeans user the IDE you are using is better today because of the IDE you are not using.

Unless it's JBuilder, the jury is still out on CodeGear. And Visual Cafe got the mercy killing years ago, mostly due to funding issues at WebGain. And IntelliJ, *covers*ears* LA LA LA I CAN'T HEAR YOU LA LA LA. BlueJ? Good news for you, they raised the minimum wage. JDeveloper is just another tool for Oracle Sales reps to insure Lock in... and...

Oops.... we came so far and I blew it!

About January 2007

This page contains all entries posted to ... And They Shall Know Me By My Speling Errors in January 2007. They are listed from oldest to newest.

December 2006 is the previous archive.

February 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33