So sometimes when reading through code, you'll find something just off. I'm not talking about formatting things, because that's all just preference. I'm talking about just weird things.
Here are some examples that I've seen:
Code:
The comment said "if boolean, than do nothing"... Why not just do:
Code:
There was also:
Code:
We also saw a bunch of public static const ints, when they could just be in an enum.
And there's this pattern which is just dumb:
Code:
There was also:
Code:
And finally:
Code:
Here are some examples that I've seen:
Code:
if (boolean)
{
}
else
{
...
}
The comment said "if boolean, than do nothing"... Why not just do:
Code:
if (!boolean)
{
...
}
There was also:
Code:
try {
...
} catch (Exception e) {
throw e;
}
We also saw a bunch of public static const ints, when they could just be in an enum.
And there's this pattern which is just dumb:
Code:
function() {
retval = 0;
try {
retval = function2();
catch { }
return retval;
}
There was also:
Code:
if (false && something_else) {...}
And finally:
Code:
if (!Page.IsPostBack)
{
bindDataGrid(true);
}
else
{
bindDataGrid(false);
}