Archive for the 'Refactoring' Category

Refactoring Could’ve Saved the Day

November 2nd, 2007 Posted in Refactoring, Software Engineering | Comments »

I have ran into a few snags while trying to update parts of my code that depended on other peoples’ code. Other people updated the interface of their modules, and I needed to update the way my module interacted with theirs. Being slightly optimistic and feeling a bit of schedule pressure, a simple identifier substitution [...]

Explicitly Redundant

October 12th, 2007 Posted in Refactoring | Comments »

Today, I caught myself doing this:
bool f()
{
bool r;
if( x == y )
{
r = true;
}
else
{
r = false;
}

return r;
}

When I really should have written:
bool f()
{
return x == y;
}

In the actual code [...]