Comments smell! Replace them with more expressive code.

As already pointed out in that post, here's another code example:
...
//300 = Italy
if(aCompany.NationId == 300)
{
...
}
...
The comment above the if clause is definitely a code smell. If you wouldn't have that and you come back three months after releasing the software in search for a bug, you probably don't remember what's the meaning of 300, right? Therefore, refactor it by writing more expressive code:
...
if(aCompany.NationId == Nation.TypeOf.Italy)
{
...
}
...
The comment is completely useless now. Every developer in the team will now understand the meaning of this code without any effort. Note, such code can lower the mean-time-to-repair (MTTR) significantly.
Kindle

Comments

0

Your ad here?