Last time I checked Gayle, you were in support? Not development?
Quote:
'No comments in functions themselves, if the code needs it it's too complex for easy maintenance'
|
To be honest, thats just crap. I pity you if the day ever comes when someone calls you at 4 in the morning saying 'blah blah' has broken can you fix it. Its bad enough if its your own code, but even worse if its someone else's.
Lack of comments in code gets right on my tits.
Also, what is the case if the code is complex? There will always be instances (unless your only doing trivial things) where the code can get compilcated. Always remember that whatever you write, it will be 10 times more compilcated for someone else to alter.
As a result I tend to comment fairly heavily, most people wont like my notation mind as I use Hungarian notation, but heres an example snippet from a recently used method.
Code:
/////////////////////////////////////////////////////////////////////////
// Initialise And Connect To DB
// Open Databse Connection
SqlConnection objConnection = new SqlConnection(ConfigurationSettings.AppSettings["SQLConnection"]);
objConnection.Open();
/////////////////////////////////////////////////////////////////////////
// Validate User Login
// Create Command Interface
SqlCommand cmdStoredProc = new SqlCommand("db_CheckLogin", objConnection);
cmdStoredProc.CommandType = CommandType.StoredProcedure;
// Fill The Parameters Collection Based Upon Stored Procedure.
SqlParameter workParam = null;
workParam = cmdStoredProc.Parameters.Add("@LoginName", SqlDbType.Char, 15);
workParam = cmdStoredProc.Parameters.Add("@Password", SqlDbType.Char, 15);
// Prepare Output Parameter
workParam = cmdStoredProc.Parameters.Add("@ReturnCode", SqlDbType.UniqueIdentifier, 16);
workParam.Direction = ParameterDirection.Output;
// Set Values For Our Procedure
cmdStoredProc.Parameters["@LoginName"].Value = ctrlUsername.Text;
cmdStoredProc.Parameters["@Password"].Value = ctrlPassword.Text;
// Exec Procedure
cmdStoredProc.ExecuteNonQuery();
/////////////////////////////////////////////////////////////////////////
// Next Thing .... etc etc