Link Details

Link 76211 thumbnail
User 259856 avatar

By rtball
via codesqueeze.com
Published: Apr 16 2008 / 16:42

Can anyone else think of a cleaner, more highly used piece of “pocket code” than the good old State enumeration that they have used time and time again in projects?
  • 5
  • 37
  • 4423
  • 2455

Comments

Add your comment
User 275423 avatar

lifewithryan replied ago:

1 votes Vote down Vote up Reply

I just skinned this cat today in Grails with a custom taglib. Grails makes me all giddy. It even includes the ability to pass in a selected state by default. Rought 8 lines of code, (minus the actual key:value pair Map of course, but suppose I could have put that all on one line *wink*).

User 204084 avatar

kenman replied ago:

0 votes Vote down Vote up Reply

If you're going to claim something so definitive using adjectives such as "most", "ever", and "period", it better damn well be worth it. This isn't.

To be truly reusable, why not structure it in a manner which makes it language agnostic (XML comes to mind)?

User 152955 avatar

Gregg Bolinger replied ago:

0 votes Vote down Vote up Reply

Weak

User 200691 avatar

lem z replied ago:

3 votes Vote down Vote up Reply

you know... planet USA only has about 5% of the world's population...

User 257910 avatar

goshki replied ago:

0 votes Vote down Vote up Reply

The title should rather be "The Most Reusable Piece Of Code Ever In The US…Period" to prevent confusion.

User 209464 avatar

willcode4beer replied ago:

-1 votes Vote down Vote up Reply

because all we do is write code that needs a list of states and their abbreviations......

post was weak

User 278286 avatar

kocka replied ago:

-1 votes Vote down Vote up Reply

Heh... You could code the ten commandments, that did not change in the last two thousand years, so we could call it constant. (as much as history is constant)

But it really perfectly demonstrates how some american coders ignore the rest of the world. No kiding, I know people over there still using ASCII :-) It is just not reusable at all.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.