DevDisasters - Hired Help for the Holidays
-
In this, my latest DevDisasters, I wrote up an appropriately holiday themed article that I'm sure will warm the cockles of your heart and leave you in a festive mood.
-
The issue stood out the second that I look at the code, almost expected it.
Also, ding them for lacking the
using
keyword.DataSet
implementsIDisposable
!
-
Many n00b devs don't know that in
if a and b
If a is false, b won't be evaluated. There's a name for that but I don't remember it.
-
There's a name for that but I don't remember it.
Short-circuiting. Or more formally short-circuit evaluation.
-
boolean operator short circuiting.
usually.
makes sense if you have enough information to know what the answer is going to be (
FALSE AND
orTRUE OR
) why bother calculating the rest?EDIT: Hanzo'd
-
You see it a ton with VB .NET where you have
And
versusAndAlso
......when I first touched C-style code over a decade ago in my teens, I used&&
for a while before I even knew that&
existed.
-
So did the Find-Replace for & -> && catch the instances where they had already used && and make them into &&&&?
-
Guillaume tried to explain to the team that it's not the same thing; that, yes, in most cases the result of the expression would be the same, but in this case they wanted the if statement to stop evaluating if the first part wasn't met.
And that's his biggest problem with using
&
instead of&&
? And not, say, that it gives a result that's occasionally totally wrong? (1 & 2 == false
)Before deploying to stage, he would run a replace-all to fix the changed code, all the while thinking that January couldn't come soon enough.
And that's his solution, introducing silent bugs when anyone tries to use
&
legitimately?I think we found TRWTF...
-
And that's his solution, introducing silent bugs when anyone tries to use & legitimately?
Based on the snippet, there's no way that they legitimately use the
&
operator anywhere.That being said, each usage should be examined individually.
-
-
This post is deleted!
-
Oh, yeah, that's C#. Remind me to coffee first, post later.
Still, this stands:
And that's his solution, introducing silent bugs when anyone tries to use & legitimately?
I think we found TRWTF...
-
Oh, yeah, that's C#. Remind me to coffee first, post later.
..though in fact it doesn't have C#. But still.
-
Nice short article thanks...
I am sure lots of shops that are retail dependent and 4th quarter is their bread and butter get hit with all sorts of things like this.
...and not just programmers, but systems buckling under load not considered, or end users that do something unexpected and create minor havoc.
In one of my former gigs, we had UPS manifest, where we generated UPS labels in bulk and send UPS the list at the end of the day. This was for fulfillment and in one unique accident due to substantial system load, every package was getting a copy of one individual shipping address. Packages shipped and this poor lady called us in a panic with all these packages sitting in isles in her apartment up to the ceiling. In any case, we went into damage control and shipped these packages from her apartment until all got to the right people/locations.
We sent her gifts and she was known as our 'Texas office' for a time. We would be like, "Call Texas, she probably has the package". She would pull out the packing list and we shipped her a label printer and she printed new labels from her couch!
She wasn't mad about it and we were not either. Some companies and management would go on a witch hunt, but seriously when is it 90 miles an hour day in and day out for three months, you really try work from an energy and emotion conservation perspective.
We got the problem solved after about two or three incidents and off we went back to normal operation.
-
-
I wonder what front-paginization would do to this story.
-
"Like a ninjess in the night, the Texas office manager crept through her apartment between stacks of Frank's mess..."
-
It'd be an interesting AI project to take any English text as input and output a TDWTF front page story.
-
So long as you remember to cornify a random significant word and put some pop culture references in HTML comments, you'll be OK.