I get the impression that the original dev was in way way over his/her head (it isn't exactly junior-level stuff), so he/she found something that was sort of close on the interwebs and fiddled with it endlessly until he/she actually got it to work. Then he/she just left it there. It was so unbelievably complex in needless ways that I can only surmise that the original dev didn't really understand it either.
Mauszer
@Mauszer
Best posts made by Mauszer
Latest posts made by Mauszer
-
RE: Are you sure that is the alignment you want?
-
RE: Are you sure that is the alignment you want?
Thanks.
Based upon the following (just ran across this sitting at the bottom of the class), even the original developers were not confident about the quality of the code.
public bool IsReusable
{
get
{
return false;
}
}I agree with them. Who would ever want to re-use this stuff?
-
Are you sure that is the alignment you want?
I work on a lot of projects that originally started overseas. Every once in a while you will open a code file and your eyes glaze over. The longer you stare at it, the more you start to wonder "Is this code totally convoluted or am I just not smart enough to interpret it?". Then at some point you run across something that causes an epiphany, and you feel better about your world.
I spent the morning staring at a class that seemed to have hundreds upon hundreds of lines of unused code, and I was thoroughly befuddled as to why it was written in such a complex fashion. Then I started running across little gems like this:
int alignment = 1;
if (alignment == 1)
{
format.Alignment = StringAlignment.Near;
}
else if (alignment == 2)
{
format.Alignment = StringAlignment.Center;
}
else
{
format.Alignment = StringAlignment.Far;
}
format.LineAlignment = StringAlignment.Center;And even better yet, the "format" object is not used anyplace in the entire class. This is one example of many. So far I have removed over 200 lines of extraneous code (and counting).