在做代码审查时应该关注的点
- 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技术汇
阅读(
347)
评论()
编辑
收藏
举报
点击右上角即可分享
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~