Checklist
1. Make sure that there shouldn't be any project warnings.
2. It will be much better if Code Analysis is performed on a project (with all Microsoft Rules enabled)
and then remove the warnings.
3. All unused usings need to be removed. Code cleanup for unnecessary code is always a good
practice.
Refer: http://msdn.microsoft.com/en-us/magazine/ee335722.aspx.
4. 'null' check need to be performed wherever applicable to avoid the Null Reference Exception at
runtime.
5. Naming conventions to be followed always. Generally for variables/parameters follow Camel casing
and for method names and class names follow Pascal casing.
Refer: http://msdn.microsoft.com/en-us/library/ms229043.aspx.
6. Make sure that you are aware of SOLID principles.
Definition from Wikipedia: In computer programming, SOLID (Single responsibility, Open-closed,
Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym
introduced by Michael Feathers for the "first five principles" identified by Robert C. Martin[1][2] in the
early 2000s[3] that stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.[3] The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software's source code until it is both legible and extensible. It is typically used with test-driven development, and is part of an overall strategy of agile and adaptive programming.
Refer: http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)
7. Code Reusability: Extract a method if same piece of code is being used more than once or you expect it to be used in future. Make some generic methods for repetitive task and put them in a related class so that other developers start using them once you intimate them. Develop user controls for common functionality so that they can be reused across the project.
Refer: http://msdn.microsoft.com/en-us/library/office/aa140806(v=office.10).aspx
http://blogs.msdn.com/b/frice/archive/2004/06/11/153709.aspx
8. Code Consistency: Let's say that an Int32 type is coded as int and String type is coded as string then they should be coded in that same fashion across the application. But not like sometimes int and sometimes as Int32.
9. Code Readability: Should be maintained so that other developers understand your code easily.
Refer: http://msdn.microsoft.com/en-IN/library/aa291591(v=vs.100).aspx
10. Disposing of Unmanaged Resources like File I/O, Network resources, etc. They have to be disposed of once their usage is completed. Use usings block for unmanaged code if you want to automatically handle the disposing of objects once they are out of scope.
Refer: http://msdn.microsoft.com/en-us/library/498928w2.aspx
11. Proper implementation of Exception Handling (try/catch and finally blocks) and logging of exceptions.
Refer: http://msdn.microsoft.com/en-us/library/vstudio/ms229005(v=vs.100).aspx
12. Making sure that methods are having less number of lines of code. Not more than 30 to 40 lines.
13. Timely check-in/check-out of files/pages at source control (like TFS).
Refer: http://www.codeproject.com/Tips/593014/Steps-Check-in-Check-Out-Mechanism-for-TFS-To-avoi
14. Peer code reviews. Swap your code files/pages with your colleagues to perform internal code reviews.
15. Unit Testing. Write developer test cases and perform unit testing to make sure that basic level of testing is done before it goes to QA testing.
Refer: http://msdn.microsoft.com/en-us/magazine/cc163665.aspx
16. Avoid nested for/foreach loops and nested if conditions as much as possible.
17. Use anonymous types if code is going to be used only once.
Refer: http://msdn.microsoft.com/en-us/library/vstudio/bb397696.aspx
18. Try using LINQ queries and Lambda expressions to improve Readability.
Refer: http://msdn.microsoft.com/en-us/library/bb308959.aspx
19. Proper usage of var, object, and dynamic keywords. They have some similarities due to which most of the developers have confusions or don’t know much about them and hence they use them interchangeably, which shouldn't be the case.
Refer: http://blogs.msdn.com/b/csharpfaq/archive/2010/01/25/what-is-the-difference-between-dynamic-and-object-keywords.aspx
20. Use access specifiers (private, public, protected, internal, protected internal) as per the scope need of a method, a class, or a variable. Let's say if a class is meant to be used only within the assembly then it is enough to mark the class as internal only.
Refer: http://msdn.microsoft.com/en-us/library/kktasw36.aspx
21. Use interfaces wherever needed to maintain decoupling. Some design patterns came into existence due to the usage of interfaces.
Refer: http://msdn.microsoft.com/en-IN/library/3b5b8ezk(v=vs.100).aspx
22. Mark a class as sealed or static or abstract as per its usage and your need.
Refer: http://msdn.microsoft.com/en-us/library/ms173150(v=vs.100).aspx
23. Use a Stringbuilder instead of string if multiple concatenations required, to save heap memory.
24. Check whether any unreachable code exists and modify the code if it exists.
25. Write comments on top of all methods to describe their usage and expected input types and return type information.
26. Use a tool like Silverlight Spy to check and manipulate rendered XAML in Runtime of a Silverlight application to improve productivity. This saves lot of back & forth time between Design & Run views of the XAML.
27. Use fiddler tool to check the HTTP/network traffic and bandwidth information to trace the performance of web application and services.
28. Use WCFTestClient.exe tool if you want to verify the service methods out of the visual studio or by attaching its process to visual studio for debugging purpose.
29. Use constants and readonly wherever applicable.
Refer:
o http://msdn.microsoft.com/en-us/library/acdd6hb7(v=vs.100).aspx
o http://msdn.microsoft.com/en-us/library/e6w8fe1b(v=vs.100).aspx
30. Avoid type casting and type conversions as much as possible; because it is a performance penalty.
Refer: http://msdn.microsoft.com/en-us/library/ms173105.aspx
31. Override ToString (from Object class) method for the types which you want to provide with custom information.
Refer: http://msdn.microsoft.com/en-us/library/ms173154(v=vs.100).aspx
32. Avoid straightaway copy/pasting of code from other sources. It is always recommended to hand written the code even though if you are referring the code from some sources. By this you will get good practice of writing yourself the code and also you will understand the proper usage of that code; finally you never forget it.
33. Always make it a practice to read books/articles, upgrade and follow the Best Practices and Guidelines by industry experts like Microsoft experts and well-known authors like Martin Fowler, Kent Beck, Jeffrey Ritcher, Ward Cunningham, Scott Hanselman, Scott Guthrie, Donald E Knuth.
34. Verify whether your code have any memory leakages. If yes, make sure that have been fixed.
Refer: http://blogs.msdn.com/b/davidklinems/archive/2005/11/16/493580.aspx
35. Try attending technical seminars by experts to be in touch with the latest software trends and technologies and best practices.
36. Understand thoroughly the OOPs concepts and try implementing it in your code.
37. Get to know about your project design and architecture to better understand the flow of your application as a whole.
38. Take necessary steps to block and avoid any cross scripting attacks, SQL injection, and other security holes.
39. Always encrypt (by using good encryption algorithms) secret/sensitive information like passwords while saving to database and connection strings stored in web.config file(s) to avoid manipulation by unauthorized users.
40. Avoid using default keyword for the known types (primitive types) like int, decimal, bool, etc. Most of the times it should be used in case of Generic types (T) as we may not be sure whether the type is a value type or reference type.
Refer: http://msdn.microsoft.com/en-us/library/xwth0h0d(v=vs.100).aspx

Code Review Checklist and Guidelines for C# Developers的更多相关文章

  1. Code Review Checklist

    左按:当年需要一份详细的代码评审清单作参考,翻译了此文. 版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[-] General Code Smoke Test 通用测试 Comm ...

  2. Java相关|Code Review Checklist(Server)

    安全 所有入参均经过校验,包括验证参数数据类型.范围.长度,尽可能采用白名单形式验证所有的输入.对于非法请求,记录WARN log.参考Input Validation Cheat Sheet:前后端 ...

  3. 0919-The Standard of Code Review

    The primary purpose of code review is to make sure that the overall code health of Google’s code bas ...

  4. 15个最佳的代码评审(Code Review)工具

    代码评审可以被看作是计算机源代码的测试,它的目的是查找和修复引入到开发阶段的应用程序的错误,提高软件的整体素质和开发者的技能.代码审查程序以各种形式,如结对编程,代码抽查等.在这个列表中,我们编制了1 ...

  5. 大家是怎么做Code Review的?

    先说说我们公司现在的做法,一个团队被人为地分为两个阵营:Senior Developers和Junior Developers,比例差不多是1:1,Senior Developers就担负着对Juni ...

  6. Code Review Engine Learning

    相关学习资料 https://www.owasp.org/index.php/Code_review https://www.owasp.org/images/8/8e/OWASP_Code_Revi ...

  7. 什么是Code Review(转)

    Code Review是一种通过复查代码提高代码质量的过程,在XP方法中占有极为重要的地位,也已经成为软件工程中一个不可缺少的环节.本文通过对Code Review的一些概念和经验的探讨,就如何进行C ...

  8. 17款code review工具

    本文是码农网原创翻译,转载请看清文末的转载要求,谢谢合作! 好的代码审查器可以大大地帮助程序员提高代码质量,减少错误几率. 虽然现在市场上有许多可用的代码审查工具,但如何挑选也是一个艰巨的任务.在咨询 ...

  9. 什么是Code Review

    Code Review 是一种通过复查代码提高代码质量的过程,在XP方法中占有极为重要的地位,也已经成为软件工程中一个不可缺少的环节. 本文通过对Code Review的一些概念和经验的探讨,就如何进 ...

随机推荐

  1. SpringMVC的实现过程

    Spring Web MVC 处理Http请求的大致过程: 一旦Http请求到来,DispatcherSevlet将负责将请求分发.DispatcherServlet可以认为是Spring提供的前端控 ...

  2. sshd_config优化

     sshd_config优化linux系统调优,参考百度搜索  linux ssh命令  /etc/init.d/sshd restart    重启ssh  193  ls  194  vim /e ...

  3. zoj1004-Anagrams by Stack 【栈 dfs】

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4 Anagrams by Stack Time Limit: 2 Seconds ...

  4. day11:vcp考试

    Q201. Which two options are available in the Virtual Machine Component Protection (VMCP) setting Res ...

  5. 数据流滑动窗口平均值 · sliding window average from data stream

    [抄题]: 给出一串整数流和窗口大小,计算滑动窗口中所有整数的平均值. MovingAverage m = new MovingAverage(3); m.next(1) = 1 // 返回 1.00 ...

  6. postman 使用 - 连接不到接口

  7. [leetcode]299. Bulls and Cows公牛和母牛

    You are playing the following Bulls and Cows game with your friend: You write down a number and ask ...

  8. 10-Linux与windows文件互传-pscp坑---- 'pscp' 不是内部或外部命令,也不是可运行的程序或批处理文件

    1.下载pscp工具http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html 2.拷贝到C:\Windows\System32 如 ...

  9. MD5加密获得文件的MD5码

    哈希函数将任意长度的二进制字符串映射为固定长度的小型二进制字符串.加密哈希函数有这样一个属性:在计算不大可能找到散列为相同的值的两个不同的输入:也就是说,两组数据的哈希值仅在对应的数据也匹配时才会匹配 ...

  10. 全屏API

    by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=2679 二.相关文章以 ...