Virginia N was trying to refactor some code, and that meant understanding where the value m_PSOC_SIG
was used, and why. So, she did some searching, and found this line, which doesn’t contain our value:
ChangePosition("P",true,(bool)ar[6],(DateTime)ar[1],(DateTime)ar[5]);
Now, you might be asking yourself, “what’s the problem?”
Well, let’s put this into a little context. You’re probably familiar with the “do the same thing on both branches” if statement, like this:
if (m_ProgEnt.SAFF_SIG==m_PSOC_SIG)
{
ChangePosition("P",true,(bool)ar[6],(DateTime)ar[1],(DateTime)ar[5]);
}
else
{
ChangePosition("P",true,(bool)ar[6], (DateTime)ar[1], (DateTime)ar[5]);
}
Now, that’s annoying, but it’s not a full-on WTF. It’s the sort of thing that probably just accrues in old code-bases, the gradual decay of good- well, not godawful- code into bad by changing requirements and rushed timelines. Once upon a time, the branches probably were different. But neither of those are the line I posted above. Here’s the full code in context:
if (m_ProgEnt!=null)
{
if (m_ProgEnt.SAFF_SIG==m_PSOC_SIG)
{
ChangePosition("P",true,(bool)ar[6],(DateTime)ar[1],(DateTime)ar[5]);
}
else
{
ChangePosition("P",true,(bool)ar[6], (DateTime)ar[1], (DateTime)ar[5]);
}
}
else
{
}
ChangePosition("P",true,(bool)ar[6],(DateTime)ar[1],(DateTime)ar[5]);
Virginia removed the conditionals.