- 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
This one is somewhat concerning. I'll leave it as an exercise for the reader to determine why.
Whoever wrote this is unaware of the difference between "nought" (zero) and "naught" (nothing). And if it's handled earlier, why are we even here?
Addendum 2022-02-28 06:47: It might be indifference rather than a lack of awareness, but that's actually worse.
Admin
My browser is broken. I searched for the keyword
default
and there were no matches. Not in the article and not in the code. At least this statement inside the giant switch construct would make the un-maintainableif
construct superfluous.Admin
According to the built in dictionary on my laptop "nought" as a synonym for "nothing" is accepted usage.
As an alumnus of the University of York, I would say "do nowt" is correct.
Addendum 2022-02-28 07:29: I should have said nought is a synonym for nothing in American English, not British English.
Admin
TRWTF
Admin
I think, in Javascript, if the default statement has no code associated e.g.
then it is itself superfluous. You might still put it in, but only for documentation purposes. Thus the
if
construct is already superfluous unless it has anelse
(not shown) to handle any other cases.Addendum 2022-02-28 07:39: Turns out I'm wrong about the
if
being superfluous (see below).Admin
FTA
No it doesn't. The
if
condition tests for 33 different strings. Theswitch
statement has... well, I gave up counting at 48 cases. Theif
filters out several strings that are perfectly fine as far as theswitch
is concerned.Admin
Neither the if now the switch check for "FILE_NOT_FOUND"
Admin
this reminds me of something i read in an old gaming magazine: someone working on a Baseball game made a typo in a complex formula, a "-" instead of "+"...and this single wrong character made the ENTIRE "curveball" subroutine work BACKWARDS! that is, if you tried to make the ball curve left, it would curve right instead! an interesting example of how easy it is for program "bugs" to occur.
Admin
I didn't too much mind the previous monster switch, but this atrocious. ONE copy of your magic strings! I don't really care if they are constants or in the switch, I very much care if they occur more than once.
Admin
I may be weird in that, but my main complaint is that the
is on the same level of indentation as the
Admin
BrE here: "naught" => nothing, 'i care naught for that' "nought" => zero, 'dial one-nought-one for help'
Admin
That is the PASCAL style of scoping, just imagine it as begin end :-)
Admin
I think we all know the real point of minification is to hide embarrassing code.
Admin
Yeah, well, I'm British, so they very much are different.
Admin
This is JavaScript, so CONSTANT_WITH_TYOP would just autoinitialize to "undefined", right? Yeah, ok, that's slightly better. (They probably have proper enum types now, though? I kinda stopped paying attention around the time .querySelectorAll() became a thing.)