Sunday, December 28, 2008

Unintentionally Funny Code

So, a couple of weeks ago I was at work, digging through the codebase, trying to root out hard-coded client-specific logic.

Here's what I found (genericized to avoid non-disclosure problems):

public class Class1
{
public virtual bool IsClientOne()
{
return Class2.CanUseOptionA();
}
}


And then...

public class Class2
{
public virtual bool CanUseOptionA()
{
switch(Class3.Id)
{
case (int) Class3IdValue.ClientOne:
return true;
default:
return false;
}
}
}

No comments:

The City Born Great - How Long 'Til Black Future Month?

The second story in N. K. Jemisin's anthology How Long 'Til Black Future Month? , "The City Born Great," is an exciting ta...