写好代码的10大秘诀

ID:3901496

大小:215.45 KB

页数:80页

时间:2017-11-25

写好代码的10大秘诀_第1页
写好代码的10大秘诀_第2页
写好代码的10大秘诀_第3页
写好代码的10大秘诀_第4页
写好代码的10大秘诀_第5页
资源描述:

《写好代码的10大秘诀》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•track10ThingsYouCanDoToWriteBetterCodeݭདҷⷕⱘकϾ⾬䆔ᵫ᭠DevelopmentManagerMicrosoftResearch,China1F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackoc

2、u•trackϔ⌕ҷⷕⱘ⡍ᗻ•剕Ầ•SolidandRobustCode•ㅔ⋕•MaintainableandSimpleCode•催ᬜ•FastCodeϔ⌕•ㅔⷁ•SmallCodeҷⷕ•݅ѿ•Re•usableCode•ৃ⌟䆩•TestableCode•ৃ⿏ỡ•PortableCode2F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•trackWhyisthiscodebad?vo

3、idMyGirlFriendFunc(CORP_DATAInputRec,intCrntQtr,EMP_DATAEmpRec,floatEstimRevenue,floatYTDRevenue,intScreenX,intScreenY,COLOR_TYPEnewColor,COLOR_TYPEPrevColor,STATUS_TYPEstatus,intExpenseType){inti;for(i=1;i<100;i++)InputRec.revenue[i]=0;for(i=1;i<100;

4、i++)InputRec.expense[i]=CorpExpense[i];UpdateCorpDatabase(EmpRec);EstimRevenue=YTDRevenue*4.0/(float)CrntQtr;NewColor=PreColor;Status=Success;if(ExpenseType==1)for(i=1;i<12;i++)Profit[i]=Revenue[i]•Expense.Type1[i];elseif(ExpenseType==2)Profit[i]=Reve

5、nue[i]•Expense.Type2[i];elseif(ExpenseType==3){Profit[i]=Revenue[i]•Expense.Type3[i];3}F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•trackWhyisthiscodebad?voidMyGirlFriendFunc(CORP_DATAInputRec,intCrntQtr,EMP_DATAEmp

6、Rec,floatEstimRevenue,floatYTDRevenue,intScreenX,intScreenY,COLOR_TYPEnewColor,COLOR_TYPEPrevColor,STATUS_TYPEstatus,intExpenseType){inti;for(i=1;i<100;i++)InputRec.revenue[i]=0;for(i=1;i<100;i++)InputRec.expense[i]=CorpExpense[i];UpdateCorpDatabase(E

7、mpRec);EstimRevenue=YTDRevenue*4.0/(float)CrntQtr;NewColor=PreColor;Status=Success;if(ExpenseType==1)for(i=1;i<12;i++)Profit[i]=Revenue[i]•Expense.Type1[i];elseif(ExpenseType==2)Profit[i]=Revenue[i]•Expense.Type2[i];elseif(ExpenseType==3){Profit[i]=Re

8、venue[i]•Expense.Type3[i];4}F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•trackBecause…•Badfunctionname–Maintainability•CrashifCrntQtrequals0–Robustness•Nocomments–Maintainability•Unnecessaryforloop–Performan

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
正文描述:

《写好代码的10大秘诀》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•track10ThingsYouCanDoToWriteBetterCodeݭདҷⷕⱘकϾ⾬䆔ᵫ᭠DevelopmentManagerMicrosoftResearch,China1F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackoc

2、u•trackϔ⌕ҷⷕⱘ⡍ᗻ•剕Ầ•SolidandRobustCode•ㅔ⋕•MaintainableandSimpleCode•催ᬜ•FastCodeϔ⌕•ㅔⷁ•SmallCodeҷⷕ•݅ѿ•Re•usableCode•ৃ⌟䆩•TestableCode•ৃ⿏ỡ•PortableCode2F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•trackWhyisthiscodebad?vo

3、idMyGirlFriendFunc(CORP_DATAInputRec,intCrntQtr,EMP_DATAEmpRec,floatEstimRevenue,floatYTDRevenue,intScreenX,intScreenY,COLOR_TYPEnewColor,COLOR_TYPEPrevColor,STATUS_TYPEstatus,intExpenseType){inti;for(i=1;i<100;i++)InputRec.revenue[i]=0;for(i=1;i<100;

4、i++)InputRec.expense[i]=CorpExpense[i];UpdateCorpDatabase(EmpRec);EstimRevenue=YTDRevenue*4.0/(float)CrntQtr;NewColor=PreColor;Status=Success;if(ExpenseType==1)for(i=1;i<12;i++)Profit[i]=Revenue[i]•Expense.Type1[i];elseif(ExpenseType==2)Profit[i]=Reve

5、nue[i]•Expense.Type2[i];elseif(ExpenseType==3){Profit[i]=Revenue[i]•Expense.Type3[i];3}F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•trackWhyisthiscodebad?voidMyGirlFriendFunc(CORP_DATAInputRec,intCrntQtr,EMP_DATAEmp

6、Rec,floatEstimRevenue,floatYTDRevenue,intScreenX,intScreenY,COLOR_TYPEnewColor,COLOR_TYPEPrevColor,STATUS_TYPEstatus,intExpenseType){inti;for(i=1;i<100;i++)InputRec.revenue[i]=0;for(i=1;i<100;i++)InputRec.expense[i]=CorpExpense[i];UpdateCorpDatabase(E

7、mpRec);EstimRevenue=YTDRevenue*4.0/(float)CrntQtr;NewColor=PreColor;Status=Success;if(ExpenseType==1)for(i=1;i<12;i++)Profit[i]=Revenue[i]•Expense.Type1[i];elseif(ExpenseType==2)Profit[i]=Revenue[i]•Expense.Type2[i];elseif(ExpenseType==3){Profit[i]=Re

8、venue[i]•Expense.Type3[i];4}F•XCHANGF•XCHANGDEDEPPwwClicktobuyNOW!ClicktobuyNOW!wmwmwowo.d.c.d.cocu•trackocu•trackBecause…•Badfunctionname–Maintainability•CrashifCrntQtrequals0–Robustness•Nocomments–Maintainability•Unnecessaryforloop–Performan

显示全部收起
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
关闭