![]() |
#2
wangnannan2015-06-18 15:32
|
自己认为对的未必是对 有可能是和公司的要求不符合 当然在一个团队里面必须遵守统一的归约 这无可争辩 可是他们硬是要说我的风格差 我就不服了 有的同事还振振有词地说我要摒弃以前的陋习 弄的我自己真的怀疑我的代码风格是不是真的不好 后来问了项目经理, 才真相大白!!! 一下摘自自己工作中的例子
相同的程序 我的代码是这样写的(省略注释 不是公司内部代码 不要对号入座 我只是举例子)

public bool ShowClientDataSet( string argQueryStatement)
{
bool bValRet ;
System.SqlClient.SqlDataReader res;
res = new System.SqlClient.SqlDataReader();
try
{
res = this.DbConnection.ExecuteQuery( argQueryStatement );
}
catch (SqlException excQueryException)
{
this.ApplicationLog.Add("Query Error , occured:"
+ excQueryException.ToString());
}
int iCount = 0;
try
{
while ( res.Read())
{
res.GetValues(this.objDataSet);
this.viewInterface.ReceiveDataSet(this.objDataSet);
iCount++;
}
}
catch (SqlException excQueryException)
{
this.ApplicationLog.Add("Query Error , occured:"
+ excQueryException.ToString());
}
if ( iCount > 0 )
{
this.viewInterface.Show();
bValRet = true;
}
else
{
bValRet = false;
}
return bValRet;
}
{
bool bValRet ;
System.SqlClient.SqlDataReader res;
res = new System.SqlClient.SqlDataReader();
try
{
res = this.DbConnection.ExecuteQuery( argQueryStatement );
}
catch (SqlException excQueryException)
{
this.ApplicationLog.Add("Query Error , occured:"
+ excQueryException.ToString());
}
int iCount = 0;
try
{
while ( res.Read())
{
res.GetValues(this.objDataSet);
this.viewInterface.ReceiveDataSet(this.objDataSet);
iCount++;
}
}
catch (SqlException excQueryException)
{
this.ApplicationLog.Add("Query Error , occured:"
+ excQueryException.ToString());
}
if ( iCount > 0 )
{
this.viewInterface.Show();
bValRet = true;
}
else
{
bValRet = false;
}
return bValRet;
}