- 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
The American educational system at its finest!
Admin
NEW YORK
NEVADA
NEW HAMPSHIRE
NEW MEXICO...
They're all Nebraska, you know?
Not to mention Maine becomes MA....
Admin
One of those WTFs that you just shake your head at.
I guess it wouldn't be any use to ask him to name state capitols, eh?
Admin
Ahh... a nice, classic, good, old-fashioned WTF. You made my day :) So bad on so many levels... like doing ToUpper BEFORE substringing it, all the way to "optimizing" for any states that are only two letters long.
Admin
This has to be my favorite WTF yet!
Admin
Michigan
Minnesota
Mississippi
Missouri
....
Admin
<FONT face="Arial Unicode MS">Wow....not much to say about this one other than WTF?!?[:|]<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT>
<FONT face="Arial Unicode MS">State codes are pretty common knowledge, and this guy chose to ignore it...."Hmmm... instead of having to read the state codes from a database I'll just get the first two characters of the state's name. What could go wrong? Brilliant!"</FONT>
Admin
Must be an optimization... why hit the database when you can just make up abbreviations?
Admin
LOL! I totally missed that part - I was blinded by the sheer stupidity of the rest of the code.
Admin
My guess is that this was an H-1B visa programmer or foreign contract (no Visa, it was written in Bangalore) who may have glanced at the list quickly and has no clue as to U.S. geography.
Admin
<font size="2">This ties in with my other "favorite" (actually very aggravating) WTF ... typified by this email I sent to Yahoo Movies a few years ago:</font>
<font size="-1">
</font>
<font size="-1">Subject: Possible Bug</font>
<font size="-1">Type your feedback here:</font>
<font size="-1"> When I clicked on showtimes for a movie </font>
<font size="-1">and it retrieved my zip code (from a </font>
<font size="-1">cookie, from a profile, whatever) which </font>
<font size="-1">is 08030, it reported that there were </font>
<font size="-1">no showtimes in my area, and had the 4-</font>
<font size="-1">digit "8030" in the "enter your zip </font>
<font size="-1">code" field. The code probably calls </font>
<font size="-1">it an integer and doesn't check for 5 </font>
<font size="-1">digits. Remember, California </font>
<font size="-1">programmers, that several states on the </font>
<font size="-1">East coast - NJ, MA, RI, and a few </font>
<font size="-1">more -- have zip codes that start in </font>
<font size="-1">zero.</font>
<font size="-1">While Viewing: http://help.yahoo.com/help/movies/</font>
<font size="2">I also have a receipt from homestarrunner.com with the same problem:</font>
</font>
<font size="-1">Your Order Number is HR45223</font>
<font size="-1">The following Items:</font>
<font size="-1"> *** Ordered ***</font>
<font size="-1"> 1 2020 Trogdor Bumper Stickers (Pk of 2)</font>
<font size="-1"> 1 0166 Trogdor Shirt - Double Extra Large</font>
<font size="-1">Will be Shipped To:</font>
<font size="-1"> Ross Presser</font>
<font size="-1"> Gloucester City, NJ 8030</font>
<font size="-1"> United States</font>
Admin
<font size="2">Well, the function is GetStateAbbreviation, not GetCorrectStateAbbreviation...</font>
Admin
Agreed, there's no usual forum-justifying this one :) +
Admin
<font size="2">hmm...doesn't check for actual existing states either.
GetStateAbbreviation("fun stuff") == "FU"
GetStateAbbreviation("x") == "X"</font>
Admin
Heh.
Public String MakeUpYourOwnStateAbbreviation{}
Guaranteed to be accurate 38% of the time!
Admin
I wish I was this coder's manager... I'd send him a three-line review:
GetStateAbbreviation("NORTH CAROLINA")
GetStateAbbreviation("NORTH DAKOTA")
GetStateAbbreviation("NORTHERN MARIANA ISLANDS")
Admin
This is why we do not have to worry about offshore outsourcing.
Admin
I really hope they stored something like a Zip Code in there as well otherwise they have a LOT of bad data...
Admin
I was wondering how they were getting state names from state abbreviations (to explain why all the orders were assigned to Nebraska)
Admin
I think butthead said it best:
"uh..huh, huh....you....DUMBASS.....!"
Admin
The biggest WTF in that code is that it doesn't accommodate those states with several words in their name, like New York (NY) or Western Tennessean Florida.
Admin
I'm guessing they get an unexpected number from the Virgin Islands, too: VIrginia.
Another WTF is how they didn't notice that a lot of their customers were from non-existent states like GE, NO, WE, SO, TE, VE.
What did they think was going on?
Admin
You mean until you looked at that list of state abbreviations, right?
Admin
This is fantabulous (if people get to make up their own state abbreviations, I get to make up my own words). Not only does the programmer not have a clue about US geography, but in their rush to optimize only abbreviating states with a name longer than two characters, they messed up, by upper casing the entire string first, then checking the length, and then taking substring and discarding the rest. Waste! Waste! Waste!
Sadly, I'm not convinced this is an H1B or a off-shore programmer. I've helped enough of my teacher friends in three states grade homework assignments. Some kids really are this dum (sic).
--- Boy, if you get any dumber you're going to need to wear a helmet.
Admin
In honor of a former colleague of mine...
"I try and try, but I just can't be cynical enough."
Admin
The company should have also been wondering where all the bad abbreviations were coming from.
What state is PE? (Pennsylvania) What state is NO (North Dakota and North Carolina)?
I find it odd that they asked "Why do we have an inordinate amount of Nebraska customers?" rather than "WhereTF are these improper abbreviations coming from?"
Admin
Damn! Beaten! 5 posts managed to sneak in within the time it took to post mine.
Admin
In defense of all of the world non-American programmers, you have to be american to be so clueless about geography.
/I keed
Admin
Maybe the results were stored in a database with a schema that prevented invalid state abbreviations from being stored. :-)
More likely, management looked at only the top 5 states or so.
Admin
That's easily explained:
The saw top results only, and apparently "NE" was there.
dZ.
Admin
When I saw this I went:
GetStateAbbreviation("Hawaii") + " " + GetStateAbbreviation("Hawaii") + " " + GetStateAbbreviation("Hawaii")
Too funny.
Admin
Wrong! Read the post again. The point was that there must be a table correctly mapping state names to abbrevations and the programmer didn't use it.
Admin
The inquiries coming from IO would be the ones that would freak me out.
That a long way off...
Admin
You mean that there's no way someone could have looked at NE and known it stands for Nebraska? Only a table could do this?
Admin
Also response to the 'there must be a table' guy WTF isn't there a foreign key to a state table? It's WTF that the system was allowing these values.
Admin
this isnt real.....
Admin
This isn't real. How many people type in their full state name. Nope, people type in the postal abbreviation. It's possible that somewhere down the line, the correct abbreviation was expanded to the state name and this dumbass "converted" it back. They also would have the zip code to fall back on.
I call BS on this one.
(and that damn capcha is not very colorblind friendly)
Admin
Okay, so it's still a WTF, but not as much as some are saying. The "optimization" that people are making such a big fuss about is there because most people will use the two letter abbreviation when entering their state online. This method exists for the people who for some reason take the time to defy convention and enter the full name. That said, I'll admit it's not too well made...
Admin
All fixed now!
public string GetStateAbbreviation(string stateName) { return stateName.SubString(0,2); }
(this was a joke btw)
Admin
Weapon recommendation: "AK"-47.
Dude doesn't even deserve to die by an "MI"-6.
As a general swipe against the country I love, I was writing a letter to my in-laws, who live in Leimen, Germany.
I was finishing the address as Liemen, DE 69181, when my wife interrupted and said I had better spell out Deutschland or Germany, or my post was going to end up in Delaware somewhere.
In the interests of keeping the bashing global, my mother-in-law has posted things to Alexandria, VA, USA, and still had them detour through Egypt.
Go figure.
City name overloading--a game we all can play. :)
Admin
If I ever see a State textbox on some online form that isn't restricted to two characters, I enter the entire name of my state rather than assume that they're going properly map "OK" to "Oklahoma" later on. Convention be damned!
Admin
Yeah! Fight the machine!
Admin
Why not limit the field entry to two characters? Then this method wouldn't need to exist.
This assumes of course that the entry was made on some sort of form field.
Admin
That's perfectly reasonable. The convention is to use the full country name on the envelope, not the ISO country code. (And I think the German convention is to put the postal code before the city.)
Once when I worked in a mail-order warehouse, i had to deal with an order from "somewhere, N.L." that kept getting misshipped to all kinds of bizarre places until someone clued in that it was from the state of Nuevo Laredo, Mexico.
Admin
(Big Sigh, Bangs head against brick wall.) This is very sad. I think whom ever wrote this code should be sent back to kindergarten to learn the states and abbreviations again. [:'(]
Admin
This is not a WTF. This is the fastest way to get an abbreviation from a state name. I bet you could get 100 wrong answers out of this function in the same time it takes to get one right answer with a table lookup.
Admin
Even my non-programmer friends in the office thought this was hilarious.
It's interesting to see that "res2" blames this on the failure of the American educational system, christoofar says it must be the work of foreign (assumed to be non-american) programmers, and WTFer says one must be "american" to make such stupid comments. I, as an american, submit that all such stupidity (as displayed both by the original WTF, and by the tendency to blame it on nationality) is instead an international resource in depressingly abundant supply.
@strongarm: you didn't make up the word fantabulous, Google returns over 170,000 hits.
I agree with those who point out that the "optimization" for checking two-character state names is actually probably the one saving grace of this routine. If someone enters a correct abbreviation, it will be passed through unmangled. Of course so will any incorrect abbreviations.
Admin
<FONT size=2><FONT size=2>
Probably If your manager asks you to name all US states you can't even name them being an US citizen or whatever the f** nationality yours is. Then why blame foreign programmers?
Would you know the state abbreviations of some other foreign country?
Think before you write Dude!
- Getter
</FONT></FONT>Admin
answers.com/fantabulous
Admin
Why would you address a letter to "Liemen, DE 69181"? That looks exactly like a city state and zip. Now, they could probably infer the intended destination by the amount of postage, the fact that there is no 69181 or Leimen in Delaware, and it was addressed to something "Strasse". But the point of standard state abbreviations and zip codes is to remove the ambiguity from addresses. Your wife was right; if you're mailing a letter in the US to Germany, then spell it out. One of my pet peeves is ambiguity created because of laziness.