Comment On A Spoonful of Sugar

John S. was doing some work on the search feature of a client's website when he noticed that he would receive a 500 Server Error if he tested against the API with an empty string. [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Re: A Spoonful of Sugar

2011-03-16 16:59 • by Nagesh
341281 in reply to 341271
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.


Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...


I am no troll. I am serous about use of magic values. E.F Codd also mention NULL as a magic value in his early papers.

Re: A Spoonful of Sugar

2011-03-16 16:59 • by Cough Sneeze Splutter (unregistered)
341282 in reply to 341173
BentFranklin:
My favorite brain melting song goes like this:

Meow meow meow meow meow meow meow meow
meow meow meow meow meow meow meow meow
meow meow meow meow meow meow meow meow
meow meow meow meow meow meow meow meow!

(http://www.youtube.com/watch?v=5JuVHCJVYf4 if you don't remember or happily were never subjected to said torture.)



Look up 'Duck Song' on YouTube....

A duck walked into a lemonade stand,
and he said to the man running the stand,
hey (bop, bop, bop)....got any grapes?

Re: A Spoonful of Sugar

2011-03-16 16:59 • by hoodaticus (unregistered)
341283 in reply to 341274
Nagesh:
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.


Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...

I am surprising it took you so long to datter-mine this. What was first clue?

+1 fpr "datter-mine".

Re: A Spoonful of Sugar

2011-03-16 17:00 • by Nagesh
341284 in reply to 341274
Nagesh:
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.


Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...

I am surprising it took you so long to datter-mine this. What was first clue?


Fake nagesh is double TRWTF.

Re: A Spoonful of Sugar

2011-03-16 17:04 • by hoodaticus
341285 in reply to 341271
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.
Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...
Seriously. I'm starting to wonder if it's really just an Indian algorithm.

Re: A Spoonful of Sugar

2011-03-16 17:08 • by HellKarnassus
341286 in reply to 341284
Nagesh:
Nagesh:
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.


Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...

I am surprising it took you so long to datter-mine this. What was first clue?


Fake nagesh is double TRWTF.

Hell yes, one Nagesh is enough TRWTF

Re: A Spoonful of Sugar

2011-03-16 17:34 • by ORLY (unregistered)
341287 in reply to 341246
Bill's Kid:
ORLY:
The Corrector:
ORLY:
Anonymous Coward:
TRWTF is ColdFusion.


TRWTF is endless dildos who think slighting every platform or technology other than the ont they're forced to use in their current slave-cube, is a WTF I've never used ColdFusion before, but I read somewhere that it's rubbish, and I believe everything I read, so I quote that article, to try and sound like I know what I'm talking about.

FTFY


FTFY

I see what you did there. But, do you?
hint: whose quote did you change...?


Hey, after the first 'FTFY', it became *our* quote!

Re: A Spoonful of Sugar

2011-03-16 17:36 • by G. (unregistered)
341288 in reply to 341281
Nagesh:
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.


Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...


I am no troll. I am serous about use of magic values. E.F Codd also mention NULL as a magic value in his early papers.


I may be very wide of the mark here, but do the words 'valoo chicken' mean anything to you?

Re: A Spoonful of Sugar

2011-03-16 17:36 • by ORLY (unregistered)
341289 in reply to 341285
hoodaticus:
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.
Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...
Seriously. I'm starting to wonder if it's really just an Indian algorithm.


Can't be - it works

Re: A Spoonful of Sugar

2011-03-16 17:42 • by Sudo
341290 in reply to 341248
boog:
Sudo:
Wouldn't it be just as easy to return an empty result set? Seems over-engineered to me.
And some people think it's over-engineering to handle input parameters that are outside the function's domain.

I'm not saying the API is intelligent, but the front-end should be aware of what inputs are valid and notify the user when they are not.
Fair point... there's never an argument against validating inputs. Still, I'd personally consider an empty string to be a dumbass input rather than an invalid one, and just handle it gracefully... If they started passing objects or integers to the function, then I'd start throwing errors.

Re: A Spoonful of Sugar

2011-03-16 17:53 • by blue (unregistered)
341291 in reply to 341198
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?


That don't look backward to me....

You're at least the second person here today who seems to struggle with the conspet of backward. Most of the syllables are still the right way

Re: A Spoonful of Sugar

2011-03-16 17:54 • by Coyne
I'd add a new item to the database, maybe ...


Entered search predicate atrocious,
Expected a system precocious,
Clicked search to find nada,
Unexpected the yada:
Supercalifragilisticexpialidocious.


Now, let the developers try to figure out why it started giving this for an empty search string...

Re: A Spoonful of Sugar

2011-03-16 17:56 • by whila (unregistered)
341293 in reply to 341214
Peter:
hoodaticus:
jumentum:
hoodaticus:
hoodaticus unregistered:
hoodaticus:
AnthonyC:
Although you can type it backwards, which is dociousaliexpiisticfragilcalirupus, but that's going a bit too far, don't you think?
That isn't backwards, dude. Neither character-wise nor syllable-wise.

Never mind. I'm a moron. I didn't realize you we're quoting the movie.
I'm just not homosexual enough...

Hardly could tell, from the name and the self-talk.
Wit Lesson #1 - before turning a phrase, it helps to understand the phrase you are turning.

How do you "turn" a phrase?


poke it in the bum

Re: A Spoonful of Sugar

2011-03-16 18:03 • by sdlfhgskd (unregistered)
341294 in reply to 341263
There is an xedit version for windows

Re: A Spoonful of Sugar

2011-03-16 18:06 • by boog
341295 in reply to 341256
frits:
I mean really boog, resorting to sock puppets. You should be ashamed of yourself.
I have many reasons to be ashamed of myself, but resorting to sock puppets is not one of them.

Re: A Spoonful of Sugar

2011-03-16 18:08 • by frits (unregistered)
341296 in reply to 341295
boog:
frits:
I mean really boog, resorting to sock puppets. You should be ashamed of yourself.
I have many reasons to be ashamed of myself, but resorting to sock puppets is not one of them.


So you're proud of your sock puppets?

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 18:09 • by boog (unregistered)
341297 in reply to 341252
[quoteuser=whila][quote user="boog"][quote user="Unfrits"][quote user="frits"][quote user="boog"][quote user="frits"][quote user="boog"][quote user="java.lang.Chris;"]The only justifiable reason for the previous developer doing this is that he/she wasn't allowed to change the underlying data access code.[/quote]Why would the previous developer have needed to change the underlying data access code? Was it broken?[/quote]

Oh I'm sure it worked as well as any super sophisticated SQL LIKE query would...
[/quote]
Maybe it does. And maybe the search operation starts out with
if (parameter is invalid)

throw a 500 error

or something to that effect. Is it unlikely that the API developers decided "empty string" was an invalid input that they didn't want to handle?[/quote]

You may want to re-read the article. The 500 error occurs when "supercalifragilisticexpialidocious" is the search term, not an empty string. Or do you mean that "supercalifragilisticexpialidocious" is a magic invalid term?

The error encountered could be something similar to this.
[/quote]

[quote user="From the Article"]he noticed that he would receive a 500 Server Error if he tested against the API with an empty string[/quote][/quote]

OK. I see right there:

[quote user="From the Article"]

<cfif Trim(url.searchText) EQ "">
<!--- empty string will cause an error --->
<cfset searchString="supercalifragilisticexpialidocious">
</cfif>


[/quote]
[/quote]

without saying "you're a fucking idiot"

I think he was calling the API directly - so that little bit with the SearchString is on the website in the real world to avoid the issue happening
[/quote]

Thanks for that. I really am fucking idiot.

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 18:12 • by neminem (unregistered)
341298 in reply to 341297
boog:
[enormous mess of incorrectly-quoted quote]
Thanks for that. I really am fucking idiot.

Apparently!

(You know what would be cool, just in general? An edit button. I hear fora have those, sometimes.)

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 18:13 • by unregistered (unregistered)
341300 in reply to 341298
neminem:
boog:
[enormous mess of incorrectly-quoted quote]
Thanks for that. I really am fucking idiot.

Apparently!

(You know what would be cool, just in general? An edit button. I hear fora have those, sometimes.)


so register - then you can edit

Re: A Spoonful of Sugar

2011-03-16 18:16 • by M (unregistered)
Simply quite atrocious.

Re: A Spoonful of Sugar

2011-03-16 18:21 • by Mary Poppins (unregistered)
If it ain't broke, it's supercalifragilisticexpialidoscious.

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 18:21 • by boog
341303 in reply to 341298
neminem:
boog (cheap imitation):
[enormous mess of incorrectly-quoted quote]
Thanks for that. I really am fucking idiot.

Apparently!

(You know what would be cool, just in general? An edit button. I hear fora have those, sometimes.)

Or a preview button. I think this boog was constructed from inferior materials.

Re: A Spoonful of Sugar

2011-03-16 18:24 • by boog
341304 in reply to 341296
frits (phony):
boog:
frits:
I mean really boog, resorting to sock puppets. You should be ashamed of yourself.
I have many reasons to be ashamed of myself, but resorting to sock puppets is not one of them.

So you're proud of your sock puppets?

Did I say proud? No, I don't believe I did.

Re: A Spoonful of Sugar

2011-03-16 18:42 • by boog
341305 in reply to 341290
Sudo:
boog:
Sudo:
Wouldn't it be just as easy to return an empty result set? Seems over-engineered to me.
And some people think it's over-engineering to handle input parameters that are outside the function's domain.

I'm not saying the API is intelligent, but the front-end should be aware of what inputs are valid and notify the user when they are not.
Fair point... there's never an argument against validating inputs. Still, I'd personally consider an empty string to be a dumbass input rather than an invalid one, and just handle it gracefully... If they started passing objects or integers to the function, then I'd start throwing errors.

I'll buy that. What probably happened here is the API devs followed the path of least resistance. If frits was correct about the cause of the error, it'd be more work to handle an empty string and no work to just allow an error that shouldn't occur if the API is used appropriately (inputs within the domain and whatnot).

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 18:48 • by neminem (unregistered)
341306 in reply to 341300
[quote user="unregistered"](You know what would be cool, just in general? An edit button. I hear fora have those, sometimes.)[/quote]

so register - then you can edit[/quote]
Well, dang. I tried so hard to avoid Muphry's Law, and yet let a deeper I'm-a-moron mistake slip in. Learn something every day (I only haven't ever registered because, like probably most people here, I generally post from work, which employs a stupid content-blocker that doesn't block tdwtf, but does block its forum - and the 'join' link is on the forum subdomain. That and I'm lazy, and registering requires an additional 10 seconds of work. But screw it, quota time used, registration submitted, you win. You can all proceed to not care.)

But speaking of, TRWTF is totally websense. It's hilarious what it does and doesn't block, sometimes.

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 19:01 • by unregistered (unregistered)
341308 in reply to 341306
neminem:
unregistered:
(You know what would be cool, just in general? An edit button. I hear fora have those, sometimes.)


so register - then you can edit

Well, dang. I tried so hard to avoid Muphry's Law, and yet let a deeper I'm-a-moron mistake slip in. Learn something every day (I only haven't ever registered because, like probably most people here, I generally post from work, which employs a stupid content-blocker that doesn't block tdwtf, but does block its forum - and the 'join' link is on the forum subdomain. That and I'm lazy, and registering requires an additional 10 seconds of work. But screw it, quota time used, registration submitted, you win. You can all proceed to not care.)

But speaking of, TRWTF is totally websense. It's hilarious what it does and doesn't block, sometimes.


I wonder how unregistered people could edit posts - based on comparing submitters IP to editters IP perhaps - or maybe just an assurance from the user (unregistered boog, say) that they really are the same unregistered boog that wrote the original post?



Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 19:11 • by neminem
341310 in reply to 341308
unregistered:
I wonder how unregistered people could edit posts

Yeah. Basically, I'm a moron, who forgot completely that he never registered, cause it remembers my username as if I was, anyway. (I suppose it could check the ip, but that'd be too much work for... basically negative gain, since it wouldn't be that difficult to spoof if you felt like it.)

I also liked the perfect demonstration of Muphry's Law I just gave in the previous post, too - which, of course, was posted right before the registration went through. Awesome. Post about how people need to preview before submitting: you should really preview before submitting, yourself.

Re: A Spoonful of Sugar

2011-03-16 19:30 • by Curious George (unregistered)
341311 in reply to 341215
Sudo:
Roy:
Not so much a WTF as a "GoreBlimey"
That should be "cor blimey", but it's easy to see how you came to make that mistake - Dick Van Dyke does the worst cockney impression known to man... it lies somewhere between Pakistani and South African.

Yeah, it turns out that the vocal trainer they hired for Dick was Irish, and also couldn't do a decent cockney.

Re: A Spoonful of Sugar

2011-03-16 21:43 • by Seriously? (unregistered)
What the damn is wrong with the comments on FireFox?

Re: A Spoonful of Sugar

2011-03-16 21:46 • by bgodot
Another good test case is a string containing a single (... or multiple) Unicode Byte Order Marks, which is the encoding of character 0xFEFF, a "Zero width non breaking space", that is, it has no glyph, takes up not space, and does not affect formatting; and may be stripped from the string suring processing AFTER the string is checked to not be empty.

good times.

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 21:46 • by Clueless (unregistered)
341317 in reply to 341300
unregistered:
neminem:
boog:
[enormous mess of incorrectly-quoted quote]
Thanks for that. I really am fucking idiot.

Apparently!

(You know what would be cool, just in general? An edit button. I hear fora have those, sometimes.)


so register - then you can edit

They could at least come up with a **** *** preview button for those who aren't registered!

Re: A Spoonful of Sugar

2011-03-16 21:51 • by Effeminate Black Man (unregistered)
341318 in reply to 341287
ORLY:
've never used ColdFusion before, but I read somewhere that it's rubbish, and I believe everything I read, so I quote that article, to try and sound like I know what I'm talking about.

You are so dumb. For real.

Re: A Spoonful of Sugar

2011-03-16 22:14 • by Scarlet Manuka
341320 in reply to 341203
The Great Lobachevsky:
I randomly walk around singing "per clementina si!" when the mood strikes me :)

♥ That's my favourite part of that song (though the G&S ending is also good).

Era legera
E come un fairy
E suo shoes numero nine
Herring bo-ho-ho-hoxes senza to-ho-ho-hopses
Sandale per Clementina si, per Clementina si,
Per Clementina
Sandale per Clementina
Sandale per Clementine,
Clementina, Clementina, Clementina.
Herring boxes senza topses
Sandale per Clementina,
Herring boxes senza topses
Sandale per Clementine,
Che sciagura Clementina
Che sciagura Clementina
Cara Clementina cara Clementina-na-na-na-na-na-na-na.

Re: A Spoonful of Sugar

2011-03-16 22:25 • by Fermion (unregistered)
How about Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu

Re: Pendantic Aspie Reading Comprehension Fail

2011-03-16 22:32 • by unregistered (unregistered)
341322 in reply to 341317
Clueless:
unregistered:
neminem:
boog:
[enormous mess of incorrectly-quoted quote]
Thanks for that. I really am fucking idiot.

Apparently!

(You know what would be cool, just in general? An edit button. I hear fora have those, sometimes.)


so register - then you can edit

They could at least come up with a **** *** preview button for those who aren't registered!


There is one...

Re: A Spoonful of Sugar

2011-03-16 22:51 • by f**king obvious (unregistered)
341323 in reply to 341271
C-Octothorpe:
Nagesh:
I have studied the above code and regadless to the language using by the programmer, it is valid.

Using Magic values has been computer programming standard for donkey years.


Ok, it's official. Nagesh is a troll.

The comment above is MORE than enough proof...


I would have thought his selective mastery of the English language would have given that away a LONG time ago...

Re: A Spoonful of Sugar

2011-03-17 00:09 • by Jugis (unregistered)
341325 in reply to 341244
Matt Westwood:
ORLY:
Anonymous Coward:
TRWTF is ColdFusion.


TRWTF is endless dildos who think slighting every platform or technology other than the ont they're forced to use in their current slave-cube, is a WTF


Endless dildos? Where can I get one? It's my wife's birthday in a few weeks' time.
They're locked in a drawer in the server room. You may want to talk to Derek.

Re: A Spoonful of Sugar

2011-03-17 07:34 • by wthyrbendragon (unregistered)
341329 in reply to 341097
Anon Too:
Can't be arsed to debug? Just substitute the magic word supercalifragilisticexpialidocious!

A real pro would have gone for disestablishmentarianism.


However, a rebel with experience would go with 'antidisestablishmentarianism'

Re: A Spoonful of Sugar

2011-03-17 09:56 • by anonymous (unregistered)
The real WTF is that it doesn't use the ItemNotFound Boolean value.

Re: A Spoonful of Sugar

2011-03-17 09:56 • by ThingGuy McGuyThing
341333 in reply to 341188
boog:
ThingGuy McGuyThing:
I'll probably take some flak, but I can see valid reasons for doing this rather than any of the other suggestions (bypassing search, returning the user to the search page, etc).

1) Time constraints: If the dev had another 50 critical bugs to fix that day, there's no reason he should spend any more time on this bug. An if statement and a comment suffice.
Wouldn't an if-statement suffice for bypassing the search?


Not if there's additional logic embedded in the search function, like setting up parts of the search results page.

Re: A Spoonful of Sugar

2011-03-17 10:15 • by boog
341334 in reply to 341333
ThingGuy McGuyThing:
boog:
Wouldn't an if-statement suffice for bypassing the search?

Not if there's additional logic embedded in the search function, like setting up parts of the search results page.

Sure, but if the search string is empty, why would you even display a search results page? Shouldn't you display an empty search box with an error saying "please try again"?

Re: A Spoonful of Sugar

2011-03-17 10:37 • by QJ (unregistered)
341337 in reply to 341321
Fermion:
How about Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu


Hi-ho Silver, away.

Re: A Spoonful of Sugar

2011-03-17 10:55 • by C-Octothorpe (unregistered)
341338 in reply to 341334
boog:
ThingGuy McGuyThing:
boog:
Wouldn't an if-statement suffice for bypassing the search?

Not if there's additional logic embedded in the search function, like setting up parts of the search results page.

Sure, but if the search string is empty, why would you even display a search results page? Shouldn't you display an empty search box with an error saying "please try again"?


Probably because that was above their head, or they didn't want to touch more than three lines of code to fix the defect.

I've worked with people who would return an object from a GetById method regardless of whether it was found in the DB or not. They would simply add a property "IsValid", or some equally shitty named member and check that all over the place rather than checking for null.

It's amazing what you take for granted (common sense, able to dress yourself in the morning, etc.), which some people simply lack.

Re: A Spoonful of Sugar

2011-03-17 11:17 • by Dr. Nil (unregistered)
After eading theses comments, I'm starting to get the feeling that most developers are seriously flawed, passive aggressive losers.

Re: A Spoonful of Sugar

2011-03-17 11:24 • by Me (unregistered)
341340 in reply to 341106
The whole thing

Re: A Spoonful of Sugar

2011-03-17 11:26 • by C-Octothorpe (unregistered)
341341 in reply to 341339
Dr. Nil:
After eading theses comments, I'm starting to get the feeling that most developers are seriously flawed, passive aggressive losers.


Hey! Take that back! We're not passive-agressive...

Re: A Spoonful of Sugar

2011-03-17 11:27 • by boog
341342 in reply to 341338
C-Octothorpe:
boog:
Sure, but if the search string is empty, why would you even display a search results page? Shouldn't you display an empty search box with an error saying "please try again"?

Probably because that was above their head, or they didn't want to touch more than three lines of code to fix the defect.

I doubt showing an error message and adding an "else" before the search method would require much more code than setting the search string to "supercalifragilisticexpialidocious" did, but point taken.

C-Octothorpe:
It's amazing what you take for granted (common sense, able to dress yourself in the morning, etc.), which some people simply lack.

That's more-or-less the point I've been trying to make. The author's excuse was gross incompetence, not a broken API.

Re: A Spoonful of Sugar

2011-03-17 11:49 • by Sir Robin-The-Not-So-Brave (unregistered)
341343 in reply to 341226
jumentum:
hoodaticus (unregisted, but real):
You've got to be fucking...me.

What was that you were saying about homosexuality again?

What is wrong with homosexuality? Some of my best friends (m/f) are homosexual. Personally I'm sapiosexual. Which means that most comments here are a total turn off, but there are a few gems that make me want to rub my genitals against the commenter's brains. (metaforically)

Re: A Spoonful of Sugar

2011-03-17 11:50 • by dohpaz42
341344 in reply to 341338
C-Octothorpe:
...
I've worked with people who would return an object from a GetById method regardless of whether it was found in the DB or not. They would simply add a property "IsValid", or some equally shitty named member and check that all over the place rather than checking for null....


Actually, there is merit in the idea of returning an object regardless. It all depends on your needs (or your team's needs).

TRWTF is returning null, but not checking for null before trying to use the value as an object.

Re: A Spoonful of Sugar

2011-03-17 11:59 • by jumentum (unregistered)
341345 in reply to 341343
Sir Robin-The-Not-So-Brave:
jumentum:
hoodaticus (unregisted, but real):
You've got to be fucking...me.

What was that you were saying about homosexuality again?

What is wrong with homosexuality? Some of my best friends (m/f) are homosexual. Personally I'm sapiosexual. Which means that most comments here are a total turn off, but there are a few gems that make me want to rub my genitals against the commenter's brains. (metaforically)

In a previous post, he adamantly claimed not to be, but his follow-up posts clearly indicate otherwise.
« PrevPage 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6Next »

Add Comment