Evolution of Not
-
Today while hunting down a bug for a Java 1.4 application that I maintainI ran into a piece of code that I thought was rather odd.
function someFunc(String field, boolean flag) {
if(field.equals("thing_one")) return delegate.getValue(1, flag ? false : true);
else if(field.equals("thing_two")) return delegate.getValue(2, flag ? false : true);
..snip 60 more else ifs..
}
I looked into the history of this function and saw
function someFunc(String field, boolean flag) {
if(field.equals("thing_one")) {
if(flag) {
return delegate.getValue(1, false);
} else {
return delegate.getValue(1, true);
}
} else if ...snip 60 more else if....
Someone is going to be blown away when they find out about the not-operator.
Oh and TRWTF is Java 1.4, stupid non-autoboxing jerk with no support for Generics.
-
@AJAXdrivenBuzzwords said:
Oh and TRWTF is Java 1.4, stupid non-autoboxing jerk with no support for Generics.
Indeed, I can't see any reason for 1.4 still hanging around in the corners. Is >=1.5 really that massively different that it's hard to update? What's so magical about 1.4 anyway?
-
@AJAXdrivenBuzzwords said:
Someone is going to be blown away when they find out about the not-operator.
They might even be surprised to discover that none of the elses in your quoted code serve any purpose but decoration!
-
@AJAXdrivenBuzzwords said:
Someone is going to be blown away when they find out about the not-operator.
Not to mention the idea of putting those 'things' in an array and using for loops. You know, like actually searching for a string.
-
@fbjon said:
What's so magical about 1.4 anyway?
1.4 is the last Java for toasters. The runtime bloated up quite a bit with 1.5.
Also, I think one non-sun VM is stuck at the 1.4 feature level (probably because its biggest/only customer runs it on toasters), and some people insist on not excluding it for some reason.
-
@fbjon said:
What's so magical about 1.4 anyway?
Nothing. It is just still being in use in some products that I develop for. Such as IBM WebSphere Application Servers version 6. And my employer usually only upgrades if there is no other way, such as no more support from the manufacturer.Therefore: I hail you all who can use all of these nice new features of Java 1.5 and beyond. Only, it is not for me, at least not until some time... Autoboxing? I can do without. Templates? tough luck.
Well, yes, it might be TRWTF to use WebSphere. But in some shops, you just can't upgrade whenever you feel like it. Such a step might cost millions in retesting, or may require changing code or configuration. Not something you do overnight.
-
@Weng said:
@fbjon said:
What's so magical about 1.4 anyway?
1.4 is the last Java for toasters.
Are you telling me that Cylons actually run Java 1.4?
-
@Weng said:
@fbjon said:
What's so magical about 1.4 anyway?
1.4 is the last Java for toasters.
Are you telling me that Cylons actually run Java 1.4?
-
@fbjon said:
And my employer usually only upgrades if there is no other way, such as no more support from the manufacturer.
Well, Sun supports 1.4 no more.
-
@Weng said:
I'd add that while I welcome lots of improvements with 1.5, Java EE 5 FUBAR'd some things there; Sun decided to eviscerate Entity Beans, so all my J2EE know-how was put upside down. Fortunately my current job uses 1.4, so I'm not in a hurry to "relearn the wheel" yet.@fbjon said:
What's so magical about 1.4 anyway?
1.4 is the last Java for toasters. The runtime bloated up quite a bit with 1.5.
Also, I think one non-sun VM is stuck at the 1.4 feature level (probably because its biggest/only customer runs it on toasters), and some people insist on not excluding it for some reason.