Unnecessary Commented Code
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
I've seen similar stuff in places that for some unknown reason didn't use source control, but rather comments as a versioning mechanism. (No, that place is no longer in business... Surprise) The OP probably just copied and pasted it with the intention of modifying the code, but in this case I think he forgot to perform the latter.
I wasn't, now I am, then I won't be anymore.
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
Where I work we have classes that consist for about 50% of code like that. And that while we use SVN :p I guess some people just do not dare to delete code. And probably you would not dare either if you worked at my company :laugh:
It's an OO world.
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
A place I worked at had the same thing because they didn't have any form of source control, once I got them to implement source control most of this sort of stuff was cleaned out. This particular code may also be the result of someone who doesn't "trust" source control and thinks that this is a better option, of course than person is a deluded fool but you never know.
People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs
-
I've seen similar stuff in places that for some unknown reason didn't use source control, but rather comments as a versioning mechanism. (No, that place is no longer in business... Surprise) The OP probably just copied and pasted it with the intention of modifying the code, but in this case I think he forgot to perform the latter.
I wasn't, now I am, then I won't be anymore.
Thats why code source control and review is important.:thumbsup:
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
It's really disgusting. At least they might comment only the particular line instead of whole thing & new copy of that.
public virtual bool TraverseRecord(string TraverseFor, string Id) { bool HasRows = false; string sql = ""; //sql = "SP\_NAVIGATE '" + TraverseFor + "', '" + Id + "'"; sql = "SP\_NAVIGATE\_CHILD\_T '" + TraverseFor + "', '" + Id + "'";//Calling new Stored procedure iMHUtility.ExecuteStoredProcedure(sql); if (iMHUtility.IsErrorOnExecution() == false) { if (iMHUtility.HasMoreRecords()) { HasRows = true; ValueInitialize(); } } return HasRows; }
Also they may create another parameter for sp_name in the method.
thatraja
**My Tip/Tricks
My Dad had a Heart Attack on this day so don't...
** -
It's really disgusting. At least they might comment only the particular line instead of whole thing & new copy of that.
public virtual bool TraverseRecord(string TraverseFor, string Id) { bool HasRows = false; string sql = ""; //sql = "SP\_NAVIGATE '" + TraverseFor + "', '" + Id + "'"; sql = "SP\_NAVIGATE\_CHILD\_T '" + TraverseFor + "', '" + Id + "'";//Calling new Stored procedure iMHUtility.ExecuteStoredProcedure(sql); if (iMHUtility.IsErrorOnExecution() == false) { if (iMHUtility.HasMoreRecords()) { HasRows = true; ValueInitialize(); } } return HasRows; }
Also they may create another parameter for sp_name in the method.
thatraja
**My Tip/Tricks
My Dad had a Heart Attack on this day so don't...
** -
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
Ahh... admittedly, I've been guilty of leaving commented code behind, but they were left behind to work with later. However, I don't think I ever commented copied code like that...
-
Few days ago I just reviewing some codes on a project and I found that there are too may commented unnecessary codes in each file.I am giving you all an example:
/// Traverse between Rows
//public virtual bool TraverseRecord(string TraverseFor, string Id)
//{
// bool HasRows = false;
// string sql = "";
// sql = "SP_NAVIGATE '" + TraverseFor + "', '" + Id + "'";
// iMHUtility.ExecuteStoredProcedure(sql);
// if (iMHUtility.IsErrorOnExecution() == false)
// {
// if (iMHUtility.HasMoreRecords())
// {
// HasRows = true;
// ValueInitialize();
// }
// }
// return HasRows;
//}
public virtual bool TraverseRecord(string TraverseFor, string Id)
{
bool HasRows = false;
string sql = "";
sql = "SP_NAVIGATE_CHILD_T '" + TraverseFor + "', '" + Id + "'";
iMHUtility.ExecuteStoredProcedure(sql);
if (iMHUtility.IsErrorOnExecution() == false)
{
if (iMHUtility.HasMoreRecords())
{
HasRows = true;
ValueInitialize();
}
}
return HasRows;
}Look at the TraverseRecord, the first one is definitely useless, so why some programmers leave those useless lines as comment. I think this is disgusting.
I'll admit to leaving comments behind when I'm designing new stuff but want to be able to refer to the old stuff, but I only leave it there when I forget or get distracted before finishing the new function.