Comment On I Heart Nebraska

Nathan Alden was tasked with trying to figure out why a customer's system was reporting that a large percentage of inquiries were coming from Nebraska, a state whose total population barely surpasses Manhattan's. Once digging in the code, it was pretty easy to find out why. Apparently, the original programmer didn't quite think to look past the first state on the State Abbreviation List to come up with the formula for calculating them ... [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: I Heart Nebraska

2005-06-30 13:36 • by res2
The American educational system at its finest!

Re: I Heart Nebraska

2005-06-30 13:37 • by christoofar
37358 in reply to 37357
NEW YORK

NEVADA

NEW HAMPSHIRE

NEW MEXICO...

They're all Nebraska, you know?



Not to mention Maine becomes MA....

Re: I Heart Nebraska

2005-06-30 13:40 • by mizhi
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?

Re: I Heart Nebraska

2005-06-30 13:42 • by Charles Nadolski
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.

Re: I Heart Nebraska

2005-06-30 13:42 • by Effendi
This has to be my favorite WTF yet!

Re: I Heart Nebraska

2005-06-30 13:43 • by BradC

Michigan
Minnesota
Mississippi
Missouri


....

Re: I Heart Nebraska

2005-06-30 13:44 • by skicow

Wow....not much to say about this one other than WTF?!?[:|]


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!"

Re: I Heart Nebraska

2005-06-30 13:46 • by mizhi
37364 in reply to 37363
skicow:

Wow....not much to say about this one other than WTF?!?[:|]


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!"





Must be an optimization... why hit the database when you can just make up abbreviations?

Re: I Heart Nebraska

2005-06-30 13:47 • by skicow
37365 in reply to 37360

Charles Nadolski:
...all the way to "optimizing" for any states that are only two letters long.


LOL! I totally missed that part - I was blinded by the sheer stupidity of the rest of the code.

Re: I Heart Nebraska

2005-06-30 13:47 • by christoofar
37366 in reply to 37360
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.

Re: I Heart Nebraska

2005-06-30 13:54 • by Ross Presser
37368 in reply to 37364
This ties in with my other "favorite" (actually very aggravating) WTF
... typified by this email I sent to Yahoo Movies a few years ago:




Name: Ross Presser



Subject: Possible Bug



Type your feedback here:

When I clicked on showtimes for a movie

and it retrieved my zip code (from a

cookie, from a profile, whatever) which

is 08030, it reported that there were

no showtimes in my area, and had the 4-

digit "8030" in the "enter your zip

code" field. The code probably calls

it an integer and doesn't check for 5

digits. Remember, California

programmers, that several states on the

East coast - NJ, MA, RI, and a few

more -- have zip codes that start in

zero.



While Viewing: http://help.yahoo.com/help/movies/




I also have a receipt from homestarrunner.com with the same problem:




Thank for ordering from the
Homestar Store. Your order has been accepted. You will receive a
shipping confirmation when your order has been shipped.








Your Order Number is HR45223



The following Items:



*** Ordered ***

1 2020 Trogdor Bumper Stickers (Pk of 2)

1 0166 Trogdor Shirt - Double Extra Large



Will be Shipped To:

Ross Presser


xxxxxxxxxxxxxx

Gloucester City, NJ 8030

United States



Re: I Heart Nebraska

2005-06-30 13:54 • by John Smallberries
Well, the function is GetStateAbbreviation, not GetCorrectStateAbbreviation...

Re: I Heart Nebraska

2005-06-30 14:00 • by Matt B
37370 in reply to 37360
Charles Nadolski:
Ahh... a nice, classic, good, old-fashioned WTF.  You made my day
:)




Agreed, there's no usual forum-justifying this one :)    +

Re: I Heart Nebraska

2005-06-30 14:00 • by John Smallberries
hmm...doesn't check for actual existing states either.

GetStateAbbreviation("fun stuff") == "FU"

GetStateAbbreviation("x") == "X"






Re: I Heart Nebraska

2005-06-30 14:03 • by BradC
37372 in reply to 37369

John Smallberries:
Well, the function is GetStateAbbreviation, not GetCorrectStateAbbreviation...


Heh.


Public String MakeUpYourOwnStateAbbreviation{}


Guaranteed to be accurate 38% of the time!


 

Re: I Heart Nebraska

2005-06-30 14:06 • by Maurits
37373 in reply to 37372
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")



Re: I Heart Nebraska

2005-06-30 14:11 • by Lenny
This is why we do not have to worry about offshore outsourcing. 

Re: I Heart Nebraska

2005-06-30 14:13 • by Daniel T
37375 in reply to 37373
I really hope they stored something like a Zip Code in there as well otherwise they have a LOT of bad data...

Re: I Heart Nebraska

2005-06-30 14:15 • by Anonymous
I was wondering how they were getting state names from state abbreviations (to explain why all the orders were assigned to Nebraska)

Re: I Heart Nebraska

2005-06-30 14:20 • by Fregas

I think butthead said it best:


"uh..huh, huh....you....DUMBASS.....!"

Re: I Heart Nebraska

2005-06-30 14:20 • by rogthefrog

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.

Re: I Heart Nebraska

2005-06-30 14:33 • by dubwai

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?

Re: I Heart Nebraska

2005-06-30 14:34 • by dubwai
37382 in reply to 37376

Anonymous:
I was wondering how they were getting state names from state abbreviations (to explain why all the orders were assigned to Nebraska)


You mean until you looked at that list of state abbreviations, right?

Re: I Heart Nebraska

2005-06-30 14:34 • by strongarm
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.

Re: I Heart Nebraska

2005-06-30 14:36 • by strongarm
In honor of a former colleague of mine...

"I try and try, but I just can't be cynical enough."

Re: I Heart Nebraska

2005-06-30 14:37 • by RyGuy
37385 in reply to 37379

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?"

Re: I Heart Nebraska

2005-06-30 14:38 • by RyGuy
37386 in reply to 37385
Damn!  Beaten!  5 posts managed to sneak in within the time it took to post mine. 

Re: I Heart Nebraska

2005-06-30 14:46 • by WTFer
37387 in reply to 37366
christoofar:
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.


In defense of all of the world non-American programmers, you have to be american to be so clueless about geography.

/I keed

Re: I Heart Nebraska

2005-06-30 14:46 • by Rick
37388 in reply to 37385
RyGuy:

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?"





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.

Re: I Heart Nebraska

2005-06-30 14:49 • by DZ-Jay
37389 in reply to 37385
RyGuy:

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?"





That's easily explained:



SELECT state, incident_count FROM customer_info ORDER BY incident_count



The saw top results only, and apparently "NE" was there.



    dZ.

Re: I Heart Nebraska

2005-06-30 14:51 • by Paul
When I saw this I went:



GetStateAbbreviation("Hawaii") + " " + GetStateAbbreviation("Hawaii") + " " + GetStateAbbreviation("Hawaii")



Too funny.

Re: I Heart Nebraska

2005-06-30 14:52 • by Anonymous
37391 in reply to 37382
dubwai:

Anonymous:
I was wondering how they were getting state names from state abbreviations (to explain why all the orders were assigned to Nebraska)


You mean until you looked at that list of state abbreviations, right?



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.


 

Re: I Heart Nebraska

2005-06-30 14:53 • by whoisfred
The inquiries coming from IO would be the ones that would freak me out.

That a long way off...

Re: I Heart Nebraska

2005-06-30 14:58 • by dubwai
37393 in reply to 37391
Anonymous:
dubwai:

Anonymous:
I was wondering how they were getting state names from state abbreviations (to explain why all the orders were assigned to Nebraska)


You mean until you looked at that list of state abbreviations, right?



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.



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?

Re: I Heart Nebraska

2005-06-30 15:02 • by dubwai
37394 in reply to 37389
DZ-Jay:


That's easily explained:

SELECT state, incident_count FROM customer_info ORDER BY incident_count


The saw top results only, and apparently "NE" was there.


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.

Re: I Heart Nebraska

2005-06-30 15:09 • by spacey
37395 in reply to 37394
this isnt real.....





Re: I Heart Nebraska

2005-06-30 15:15 • by Miles Archer
37396 in reply to 37395

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)

Re: I Heart Nebraska

2005-06-30 15:31 • by Ember
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...

Re: I Heart Nebraska

2005-06-30 15:32 • by Anon Y. Mouse
All fixed now!



public string GetStateAbbreviation(string stateName) { return stateName.SubString(0,2); }



(this was a joke btw)

Re: I Heart Nebraska

2005-06-30 15:34 • by smitty_one_each
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. :)

Re: I Heart Nebraska

2005-06-30 15:49 • by UncleMidriff
37400 in reply to 37397
Ember:
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...




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!

Re: I Heart Nebraska

2005-06-30 15:55 • by Ember
37401 in reply to 37400
Convention be damned!




Yeah! Fight the machine!

Re: I Heart Nebraska

2005-06-30 16:04 • by Mannix

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.

Re: I Heart Nebraska

2005-06-30 16:09 • by Chip
37405 in reply to 37399
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.

Re: I Heart Nebraska

2005-06-30 16:17 • by cm5400
(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. [:'(]

Re: I Heart Nebraska

2005-06-30 16:21 • by loneprogrammer
37408 in reply to 37370
Anonymous:
Charles Nadolski:
Ahh... a nice, classic, good, old-fashioned WTF.  You made my day
:)




Agreed, there's no usual forum-justifying this one :)


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.



Re: I Heart Nebraska

2005-06-30 16:24 • by CleverAlias
37410 in reply to 37399
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.

Re: I Heart Nebraska

2005-06-30 16:27 • by Getter
37411 in reply to 37366

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


Re: I Heart Nebraska

2005-06-30 16:30 • by loneprogrammer
37412 in reply to 37410
Anonymous:
@strongarm: you didn't make up the word fantabulous


answers.com/fantabulous

Re: I Heart Nebraska

2005-06-30 16:30 • by bobday
37413 in reply to 37399
smitty_one_each:
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. :)




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. 

« PrevPage 1 | Page 2 | Page 3Next »

Add Comment