- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I hate "if constant < variable" constructs. It's totally backwards to intuition. About the only place I ever tolerate it is if there's a possibility a String is null, in which case "if("THAT".equals(something))" at least has brevity over "if(something != null && something.equals("THAT"))"
But still. Why use it with a variable and 0???
Admin
Using a for loop would be idiomatic in some languages (specifically Scala, if the result set was a monad)
Admin
Let spring take care of the connection mgmt. I would take each of those queries and make a spring query object for each one! now that's a real WTF
Admin
I have swallowed the beast...
"Considering the current sad state of our computer programs, software development is clearly still a black art, and cannot yet be called an engineering discipline." -Bill Clinton
Admin
The new feature for which && and || was introduced was not that they worked for Booleans but that they short-circuit the evaluation order. The short-circuiting behavior is still highly relevant today.
It is not inconceivable for a language to have a single set of operators, whose evaluation-order properties differ according to which types they are used in (Pascal is an example), but I daresay it doesn't make the language prettier.
Admin
How can a row count ever return a negative number ?
This code always falls to the bottom and returns true.
Admin
Admin
My mistake. I saw "(0 < count)" and thought "(count < 0)".
Admin
Except that you're wrong.
At the end of the original code: if (0 < count) return false;
}
As you can see, if after any query "count" is greater than zero, it returns false. So, it doesn't return try if it finds a matching row, it returns false. It only returns true if it finds nothing. And, therefore you are wrong on the Internet.
Admin
Does anybody else see that besides the obvious issues that the select statement could just be one with all those tables joined on the widgetId?