|
|
|
| Non-WTF Job: WPF Developer at Mediber (Charlottenburg, DE) |
| « (Unknown) | Price in Nonsense » |
When Chris M's company finally decided to rewrite portions of their decrepit C++ application, Chris was relieved. "Finally," he thought, "no more ridiculous, unnecessary classes and enumerations."
The DlYesNo enumeration, as featured in Not the Most Thought Out Enumeration, was one of many of such “unnecessary classes and enumerations.” Chris figured that the new, cleanly-programmed J2EE application would have none of that.
“After the architects checked in their framework,” Chris said, “I started looking through the code files and started to get that sinking feeling. It only got worse when I opened up ‘YesNo.java’.
“Yes,” Chris confirmed, “it was actually the YesNo class. And in the same way that the old C++ YesNo enumeration didn't actually contain a ‘No’ member, the new YesNo class contains YES_code and N_NO_code.”
public class YesNoIndDomain extends BaseDomain {
public final static String N_NO_code = "N";
public final static String YES_code = "Y";
public final static String N_NO_decode = "No";
public final static String YES_decode = "Yes";
... snip ...
“Of course,” Chris added, “There was also a TrueFalse class.”
public class TrueFalseIndDomain extends BaseDomain {
public final static String FALSE_code = "N";
public final static String TRUE_code = "Y";
public final static String FALSE_decode = "False";
public final static String TRUE_decode = "True";
Chris left us with a “simple” example of how the YesNoIndDomain class is used...
protected void setCancelInd()throws ApplicationException {
if(data.canceledBy == null || data.canceledBy.equals(""))
{
this.cancelInd = YesNoIndDomain.N_NO_code;
}
else
{
this.cancelInd = YesNoIndDomain.YES_code;
}
}
Re: The Most Thought Out Enumeration
2007-12-17 08:33
•
by
LeadFoot
(unregistered)
|
|
When did the architects from my company starting writing code for your company?
At least they didn't return a boolean...that preserves the need to convert a character to a boolean (Y? or N?) later on. But the real WTF is that the method is marked as protected when everyone knows that it ought to be public so that everyone can party on. |
Re: The Most Thought Out Enumeration
2007-12-17 08:49
•
by
Grovesy
|
Clearly not extensible enough
Now the problem is, that just isn't extensible enough either.. consider
Though, again we could add more extensibilty with an xml defenition document and another xml mapping document... |
| « (Unknown) | Price in Nonsense » |