日期:2014-05-18  浏览次数:20397 次

新人该如何"生存"的问题
新到公司报到,被要求看以前产品的内部代码,不看不知道,一看吓一跳!好深奥啊,代码实现完全跟学校里自己鼓捣的东西天上地下,直接晕了,而且很久恢复不过来,这样的状态正常么?该怎么去适应呢?

求各位看官指点迷津啊!这样的状态太难受了!

------解决方案--------------------
只看这段:

public void Download(object sender, EventArgs e)
{
string orgFileName;
string serverFileName;

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[ "ConnectionStringFelix "].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "select OrgFilename, Filename from dbo.Felix_SupplierDocument where ObjectID = " + ((IButtonControl)sender).CommandArgument;
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
orgFileName = (string)reader[ "OrgFilename "];
serverFileName =
ConfigurationManager.AppSettings[ "UploadPath "]
+ reader[ "Filename "];
con.Close();
Response.ContentType = "APPLICATION/OCTET-STREAM ";
System.String disHeader = "Attachment; Filename=\ " " + orgFileName + "\ " ";
Response.AppendHeader( "Content-Disposition ", disHeader);
System.IO.FileInfo fileToDownload = new System.IO.FileInfo(serverFileName);
Response.Flush();
Response.WriteFile(fileToDownload.FullName);
}


就觉得你写这些代码的那位同事还需要好好提升面向对象设计能力和分析能力,

不过楼主不要怕,静下心来,平时多看看一些大师的书,比如重构,敏捷开发,.net大局观,thin in java,多看看优秀的开源代码,比如NHibernate,Enterprise library。不到三个月你就可以超过你这位同事了,真的。所以你不要气馁和退却哦