Thursday, March 27, 2008

When a boolean answer is not enought

This is the kind of post you will find in place like 'The Daily WTF' site, but i just couldn't resist to share what i found today while dealing with some External System:

ExternalSystem -> isDuableOperation( param)

-> Literal Formal Answer: "YES" | "NO"

At first i just thought why didn't return a boolean, nah never mind and i built all my API's around the following assumption

[java code]
public static boolean isDuableOperation(String param){
String output;
// Code that invoke the ExternalSystem;

return "YES".equals(output);
}

it seems simple and works perfectly fine, however few weeks later i got a call saying the UI-Flow was stop none of the inputs were validated correctly.

After digging in the logs the following was found:

[Log file simulation]
dd-mm-yyyy: INFO: com.xyz.ExternalSystemGateway-isDuableOperation -> "The variable ouput is 'ERROR' "

I was shocked, and reminds me WTF web site, then i said myself WTF with the guy who designed the interfaces and how the output should looks like, "YES/NO/ERROR". The most interesting part of this is that when i called the ExternalSystem Support even they were clueless...... :-S

No comments: