Close your eyes for a moment and visualize with me. (Hopefully you have text-to-speech turned on.) I want to try some guided imagery on you.

Your daily grind is over. You're no longer maintaining a huge application that your whole team hates. You're sitting alone in a peaceful meadow. There is a small mailbox here. Your computer is in front of you, and your favorite IDE is loaded up on the screen. You're starting a new project — a project in which you will guide the overall design. Your business rules are well-defined and you know them like the back of your hand.

You create your database and set up the rest of the initial configuration. You're ready to write your first code file.

OK, now open your eyes. Which code file was it? If you're like me, then it was a preliminary collection of constants and enumerations based on the business requirements.

A developer that worked at Chris's company in ages past had created Constants.java, and added a few constants that'd be frequently used in the application. It wasn't the ideal way to handle codes, but it certainly did the trick.

//Auto Estimating Send Estimate Assignments Request Types public static String _AUTO_STTS_OPEN = "10"; public static String _AUTO_STTS_OPEN_ACWP = "11"; public static String _AUTO_STTS_REOPEN = "20"; public static String _AUTO_STTS_NO_CLAIM = "30"; public static String _AUTO_STTS_CWP = "40"; public static String _AUTO_STTS_OIE = "-0"; public static String _AUTO_STTS_COVERAGE_QUESTION = "CQ"; public static String _STTS_PAID = "PD"; public static String _FIRE_STTS_OPEN = "OPN"; public static String _FIRE_STTS_REOPEN = "RPN"; public static String _FIRE_STTS_OIE = "OIE"; public static String _FIRE_STTS_COVERAGE_QUESTION = "COV"; public static String _FIRE_STTS_CWP = "CWP";

Over time, Constants.java grew to have more and more constants, and gradually less and less were commented, but they started being put into separate classes, employing a sophisticated "incrementing" technique for naming classes. Here's the second group of constants added to the file:

public static class _2 { public static String _A = "A"; public static String _B = "B"; public static String _C = "C"; public static String _R = "R"; public static String _S = "S"; }

There's no reason that anyone would forget these codes, right? I mean, Accepted, Blocked, Created... it should be clear to anyone that understands the business rules.

The constants stuff was going so well for them that they started moving everything into the constants:

public static class _5 { public static String _LESS_THAN = "<"; public static String _LESS_THAN_OR_EQUAL = "<="; public static String _NOT_EQUAL = "<>"; public static String _EQUAL = "="; public static String _GREATER_THAN = ">"; public static String _GREATER_THAN_OR_EQUAL = ">="; }

As the file took on more and more constants, though, things started to get a little murky.

public static class _215 { public static String _BACKSLASH = "\\"; public static String _2 = "2"; public static String _3 = "3"; public static String _4 = "4"; public static String _5 = "5"; public static String _6 = "6"; public static String _7 = "7"; public static String _8 = "8"; public static String _9 = "9"; }

Some of the groups got really long.

public static class _131 { public static String _01001 = "01001"; public static String _01003 = "01003"; public static String _01005 = "01005"; // *SNIP* (3,215 lines) public static String _VQ010 = "VQ010"; public static String _VQ020 = "VQ020"; public static String _VQ030 = "VQ030"; }

Some were started but never finished:

public static class _1269 { public static String _A = "A"; public static String _B = "B"; public static String _C = "C"; public static String _D = "D"; public static String _E = "E"; public static String _F = "F"; public static String _G = "G"; public static String _H = "H"; public static String _I = "I"; public static String _J = "J"; public static String _K = "K"; public static String _L = "L"; public static String _M = "M"; public static String _O = "O"; public static String _P = "P"; public static String _R = "R"; public static String _S = "S"; public static String _T = "T"; public static String _W = "W"; }

Some were just plain weird.

public static class _83 { public static String _LESS_THAN = "<"; public static String _LESS_THAN_OR_EQUAL = "<="; public static String _NOT_EQUAL = "<>"; public static String _EQUAL = "="; public static String _GREATER_THAN = ">"; public static String _GREATER_THAN_OR_EQUAL = ">="; public static String _GREATER_THAN_OR_EQUAL14 = ">=14"; public static String _GREATER_THAN_OR_EQUAL180 = ">=180"; public static String _GREATER_THAN_OR_EQUAL30 = ">=30"; public static String _GREATER_THAN_OR_EQUAL60 = ">=60"; public static String _GREATER_THAN14 = ">14"; public static String _GREATER_THAN180 = ">180"; public static String _GREATER_THAN30 = ">30"; public static String _GREATER_THAN60 = ">60"; public static String _14LESS_THAN = "14<"; public static String _14LESS_THAN_OR_EQUAL = "14<="; public static String _180LESS_THAN = "180<"; public static String _180LESS_THAN_OR_EQUAL = "180<="; public static String _30LESS_THAN = "30<"; public static String _30LESS_THAN_OR_EQUAL = "30<="; public static String _60LESS_THAN = "60<"; public static String _60LESS_THAN_OR_EQUAL = "60<="; }

And some even had bugs!

public static class _1641 { public static String _AB = "AB"; public static String _AK = "AB"; // *SNIP* public static String _WY = "WY"; }

I'll spare you the remaining lines of the 16,519 line file. But suffice it to say, if there's a string you need, it appears somewhere in one of the five hundred and fifty two classes.