在做代码审查时应该关注的点
- Magic number/string
- If statement, you should always use single line or brackets
- Provide default value of Enum
- Difference between abstract class and interface
- Excess inheritance--the inheritance hierarchy is too deep
- Use string.Concat, string.Format, StringBuilder instead of +
- Const vs Readonly
- Break down large method into small methods
- Using nest class to hidden information is not necessary and hurts maintainability
- Do not use new keyword to hidden base class's method, please use polymorphism
- Static class may substitute singleton pattern for simplification
- Private members/property access are not necessary if not protecting; use auto properties instead
- Use IDisposable correctly to prevent resource leak for unmanaged resources.
- Tell browser the encoding you are using with meta tag
- Make sure browsers know you want to use edge rendering if you are building HTML5 websites
- Eliminating embedded javascript and style sheets to help improve caching of your code
- Use CDN so that browser caching can improve startup time for new users.
- Reduced round-trips with fewer CSS files means you are less likely to run into browser limits of CSS
- The less code inside a Razor file the better
- Creating cached objects inside per-request classes is not necessary and adds complexity
- Routing tables are still a valid way of doing routing for much your code
posted @
2015-03-06 09:39
Fintech技术汇
阅读(
346)
评论()
编辑
收藏
举报