In today's fast-paced world of cell phones, Sega Nomads, and turn signals, we don't have time for anything. That's why we have acronyms. Just try to read until the end of this: International Business Machines Corporation. Congratulations if you're still awake – the rest of us non-MENSA types will keep referring to it as IBM.
At Chris N.'s employer, they needed the ability to look up acronyms' meanings, so one of Chris's predecessors got cracking on a solution. Not one to buy into that whole normalization thing, he created a table like the following:
ROWID | ABBR_CDE | ABBR_TXT |
---|---|---|
867 | IBM | INTERNATIONAL |
868 | IBM | BUSINESS |
869 | IBM | MACHINES |
870 | IBM | CORPORATION |
But then he came up against a wall. What about acronyms that can mean several things? Take "LA." Is it Los Angeles, Louisiana, or Louis Armstrong? Not to fear, the addition of an ABBR_IDX column made things all better.
ROWID | ABBR_CDE | ABBR_TXT | ABBR_IDX |
---|---|---|---|
1121 | LA | LOS | 1 |
1122 | LA | ANGELES | 1 |
1123 | LA | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 2 |
1124 | LA | LOUISIANA | 3 |
You might be asking yourself "does LA really represent thirty Xs in their system?" The answer is short answer is "no;" the long answer is "no, and I can't believe you counted all of the Xs." For whatever reason, that sequence was chosen as a delimiter.
protected final String ACRONYM_PHRASE_DELIMITER = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
Of course, that's the only reference to ACRONYM_PHRASE_DELIMITER in the entire codebase. Instead, the convenience of the following method is used:
private static boolean isNotAllXs( String s ) { StringBuffer test = new StringBuffer( s.trim() ); boolean retVal = false; for ( int i = 0; i < test.length(); i++ ) { if ( test.charAt( i ) != 'X' ) { retVal = true; } } return retVal; }
Now that the system could handle multiple defnitions per acronym, Chris's predecessor (or maybe someone else) went back through and updated a bunch of the old acronyms. For instance, "IBM" could now mean:
ROWID | ABBR_CDE | ABBR_TXT | ABBR_IDX |
---|---|---|---|
1181 | IBM | INTERNATIONAL | 3 |
1182 | IBM | MACHINES | 3 |
1183 | IBM | BUSINESS | 3 |
Yes, that's how it was entered. And here's another example:
ROWID | ABBR_CDE | ABBR_TXT | ABBR_IDX |
---|---|---|---|
7712 | WCAB | WORK | 1 |
7713 | WCAB | COMPENSATION | 1 |
7714 | WCAB | APPEAL | 1 |
7715 | WCAB | BOARD | 1 |
7716 | WCAB | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 2 |
7717 | WCAB | WORK | 3 |
7718 | WCAB | COMPENSATION | 3 |
7719 | WCAB | APPEALS | 3 |
7720 | WCAB | BOARD | 3 |
7721 | WCAB | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 4 |
7722 | WCAB | WORKERS' | 5 |
7723 | WCAB | COMPENSATION | 5 |
7724 | WCAB | APPEAL | 5 |
7725 | WCAB | BOARD | 5 |
7726 | WCAB | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 6 |
7727 | WCAB | WORKERS' | 7 |
7728 | WCAB | COMPENSATION | 7 |
7729 | WCAB | APPEALS | 7 |
7730 | WCAB | BOARD | 7 |
7731 | WCAB | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 8 |
7732 | WCAB | WORKMEN'S | 9 |
7733 | WCAB | COMPENSATION | 9 |
7734 | WCAB | APPEAL | 9 |
7735 | WCAB | BOARD | 9 |
7736 | WCAB | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 10 |
7737 | WCAB | WORKMEN'S | 11 |
7738 | WCAB | COMPENSATION | 11 |
7739 | WCAB | APPEALS | 11 |
7740 | WCAB | BOARD | 11 |
Chris wrote a handy data access object that communicates with the table and made a friendly hashmap for people to use., so things are at least a little better than they used to be (as this system has been in use for years now).
Still, just one acronym comes to mind, but in the spirit of solidarity, here it is in table form:
ROWID | ABBR_CDE | ABBR_TXT | ABBR_IDX |
---|---|---|---|
8411 | WTF | WHAT | 1 |
8412 | WTF | THE | 1 |
8414 | WTF | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | 2 |