Random thoughts on code review

AI智能体Devin架构解析:从代码生成到自主提交的工程实践 在AI编程助手层出不穷的今天,Devin以其独特的“智能体”定位和惊人的代码自主提交能力,迅速成为开发者社区热议的焦点。许多开发者体验后惊叹,它不仅能理解复杂需求、编写代码,甚至能自主完成高达80%的代码提交工作流。这背后究竟是如何实现的?从辅助编程到近乎自主的代码提交,Devin的“进化”路径揭示了AI智能体在软件开发流程中深度集成的核心架构与设计哲学。本文将深入剖析Devin的架构秘籍,从核心概念、工作流程、关键配置到最佳实践,为你提供一份从理解到实操的完整指南,无论你是想评估其能力,还是希望借鉴其设计 阅读详情

Copyright (c) prototype, all rights reserved。
在不对原文内容(包括作者信息)做任何改动的前提下,欢迎自由转载。

1.      Code review is a worthwhile practice/long-term investment with the following advantages:
a.       Improve overall code quality
                                                               i.      Especially helpful for novices
                                                             ii.      Especially helpful for those who are unfamiliar with the infrastructure
b.      Enforce coding standard
c.       Enhance communications among developers
                                                               i.      Know each other’s work
                                                             ii.      Prevent reinvention of wheels
                                                            iii.      Help with each other
d.      Learn from each other’s code: good/bad algorithms, good/bad coding styles, idioms/common mistakes
e.       Learn to spot problems quickly

2.      Some disadvantages:
a.       Obviously, need extra time and effort
b.      Might cause tension between people when they have difficulty to appreciate each other

3.      Difficulties and issues in practicing code review:
a.       Because of the required extra time and effort, a barrier coming from the executive level might exist. This should be overcome before anything else. Some detailed analyses of the following aspects might be necessary:
                                                               i.      The general and specific pros and cons of code review
                                                             ii.      The impact of code review to the development and maintenance both in the long term and in the short term
                                                            iii.      A moderately detailed and sound plan for conducting code review
                                                           iv.      Plan-based estimation of the extra time and effort
                                                             v.      Cost-benefit tradeoffs that the code review will cause
b.      Because some developers might feel intimidated if a mechanism is established to allow other people to assess their code, a barrier coming from the developers might also exist. To overcome this, the following things can be done:
                                                               i.      Present the pros and cons of code review.
                                                             ii.      Show clearly what benefits each developer can obtain from such a practice.
                                                            iii.      Ease and relieve any concerns like feeling embarrassed when a deficiency is caught by others. Emphasize code review is not for attacking/embarrassing people.
                                                           iv.      Show the actual plan that will effectively minimize the possibility of personal attack.
                                                             v.      Make it clear it is a required process from the higher level.
c.       In what form should a code review be conducted?
                                                               i.      A team-wide meeting can be a good choice.
                                                             ii.      Better off avoid meetings just involving two people, where bullshiting and other political silliness could likely happen.
                                                            iii.      Asynchronous reviews might be effective as well and might cost less.
d.      How often should a code view meeting be conducted?
                                                               i.      Once every two weeks might be a good choice if code view will take off one whole day.
                                                             ii.      Shorter period can also be good if code view is significantly shorter.
e.       How to get people involved?
                                                               i.      Every teammate could be involved in general.
                                                             ii.      If the team is big, 2 to 4 reviewers each time might be a good option.
                                                            iii.      If some people are extremely unfamiliar with the programming language in which the to-be-reviewed code is written, they can be spared.
                                                           iv.      People who are sick or extremely busy can be spared.
                                                             v.      People who cannot attend the meeting should submit their reviews by email.
                                                           vi.      The manager should not attend unless he has something to contribute to the reviews.
                                                          vii.      The coder(s) should present the to-be-reviewed code at least two days before the review. It is better to have the code printed into a PDF file that can be delivered to every reviewer by email. The code should be printed with line numbers.
                                                        viii.      One person will be responsible to summarize all comments in a precise and timely manner.
f.        How much code to review each time?
                                                               i.      One or more coders can submit their code for review each time.
                                                             ii.      Each code is better within 200 lines excluding comments.
                                                            iii.      More lines are OK if the algorithm is not very complicated.
                                                           iv.      Less lines are preferred if the algorithm/logic is difficult.
                                                             v.      For complicated algorithms, introductions will be very helpful or even essential.
g.       Reviewing guidelines
                                                               i.      A check list could be provided as a reference.
h.       Documentation
                                                               i.      The summarized comments should be documentated for further reference.
                                                             ii.      A unique ID for each review could be created for easy reference.
                                                            iii.      A check of the compliance of the implementation with the comments could be followed up and documented, and any rejections should be rationalized, discussed and passed.
                                                           iv.      Contributions from people should be included.
                                                             v.      The same code from should not be reviewed again unless it has been changed a lot since last time or some issues from last time has not been settled.
i.         Rewarding mechanism
                                                               i.      Experienced coders might not benefit a lot from the review.
                                                             ii.      A rewarding mechanism might be useful to stimulate the enthusiasm out of the experienced coders.
j.        Moderator
                                                               i.      Guides the meeting along and keeps everyone on task.
                                                             ii.      Making sure the meeting stays constructive and focused on the code rather than the coder

4.      Code review guidelines:
a.       Look for code that breaks the code-standard
b.      For multithreading programs, look for race conditions, dead-locks.
c.       Look for bad algorithms, which includes (but is not limited to):
                                                               i.      Unnecessarily complicated algorithms
                                                             ii.      Very inefficient algorithms
                                                            iii.      Algorithm that makes the use unnecessarily complex/difficult
d.      For security-critical programs, look for the following issues:
                                                               i.      Possible `printf’ format string vulnerabilities
                                                             ii.      Potential buffer overflows issues
                                                            iii.      Plain strings of sensitive information
e.       Look for exception-safety issues:
                                                               i.      Make sure the function satisfy one of the following exception guarantees: no-throw, strong, and weak exception guarantees.
                                                             ii.      Make sure exception is used only for exceptional situations, in other words, no abuse of exception in the code.
f.        Look for clear definition of pre- and postconditions:
                                                               i.      Make sure code enforcing these conditions is there.
                                                             ii.      Make sure the program handles different conditions properly.
g.       For number-crunching programs, look for the following:
                                                               i.      Number overflow and underflow issues
                                                             ii.      Accuracy issues (Does the operation result in an accurate result?)
                                                            iii.      Divided by zero issues
                                                           iv.      Square root of negative number issues
                                                             v.      Loss of accuracy in floating number summation
h.       For clear and effective definition of interfaces, look for the following things:
                                                               i.      The responsibility is clearly defined
                                                             ii.      The class/function does only one major thing
                                                            iii.      The name of the class and function is suggestive and clear:
1.      Too long or too short names are bad
2.      Use of unusual abbreviations is generally bad
3.      Implication of insult, violence, sex, and politics is bad
4.      Ambiguous names are always bad
5.      Non-suggestive names are bad
                                                           iv.      Encapsulation is properly done
                                                             v.      Interface is complete (Does it allow all valid operations?).
                                                           vi.      Interface is tight (Does it have a minimal set of functions?).
                                                          vii.      Interface is easy to use.
                                                        viii.      No hidden traps and pitfalls
i.         Look for bad designs:
                                                               i.      Use of global variable
                                                             ii.      Implicit share of objects among different classes
                                                            iii.      Tight coupling between different external classes
                                                           iv.      Too many responsibilities for a single class or function
                                                             v.      Non-orthogonal functions/classes.
j.        Look for wasteful use of memory.
k.      Look for resource leak:
                                                               i.      File handles
                                                             ii.      Database connections
                                                            iii.      Sockets
                                                           iv.      Memory leaks
                                                             v.      Double release of memory or other resources
                                                           vi.      Reference-counting
                                                          vii.      Event traps
                                                        viii.      Exception traps
l.         Look for code-testing issues:
                                                               i.      Is it easy to write test cases for the code?
                                                             ii.      Are the current test cases sufficient enough?
m.     Look for object-copying issues:
                                                               i.      Is it a shallow copy whereas a deep copy should be used?
                                                             ii.      Is the object-copying efficient?
                                                            iii.      Does it cause illegal memory use?
n.       Look for code that may not be portable
o.      Common mistakes
                                                               i.      Out-of-bound array index
                                                             ii.      Reading uninitialized object
                                                            iii.      Type mismatch
                                                           iv.      Bad/unsafe type conversion
                                                             v.      Bug-fix change function’s behavior
                                                           vi.      Returning reference to a temporary object
                                                          vii.      Hug array in stack
p.      Guideline can be specified for a particular field of programming.

5.      Art of reviewing
a.       Bottomline – reviewing is mainly a process of learning, understanding, and discussion, rarely of accusation, attacking, and commanding.
b.      Focus on the code, rather than the coder.
c.       Be inspiring, instead of dismaying.
d.      For an obviously “mistake” or an oddness, query whether there is a reason behind that, instead of saying the code breaks thing or the code is wrong.
e.       Avoid using “why” when asking questions, instead say that you see something unusual and state what you would do and the reasons, and then query the author’s reason(s) backing his choice.
f.        Don't blame people for bugs. No finger pointing!
g.       Don't forget to praise.
h.       Be patient in explaining technical details to the reviewee.
i.         For reviewee, don’t assume attack. Explain with patience your intention for the problematic code.
j.        For reviewee, have the guts to admit mistakes.
k.      It might be better to not cover coding standards violations in the meeting, instead mention these via email or in person.
l.         Before review is done, code can be checked into a private branch. After review and after all changes are done (any rejections should be discussed with and passed by the reviewers), the code is merged into the parent branch.
m.     Stick to reviewable issues. Develop a list of reviewable issues. Don't allow reviews on other items without changing the list. This is for preventing people from spending time on off-topic arguments.
n.       Unless a manager has something to contribute to the reviews, they shouldn't be involved.
o.      If issues come up during the review that everyone in the team could benefit from, make the wisdom public (wiki might be a good choice for this).
 
【产品体系】第六十五篇 Nacos / HiClaw / HiMarket 体系01 子系统核心现象主力数学工具​变更传播 fan-out / cache staleness图 fan-out 分析、概率上界 P(Tstale​)、logical-clock version monotonicityHigress 网关​突发限流、延迟堆积排队论 (M/G/1)、Token/Leaky Bucket ODE、Little's Law L=λWHiMarket 检索​语义匹配召回、去冗余。 阅读详情

相关推荐

SpringBoot+Vue+Mysql社区医院信息平台(源码+文档)

SpringBoot+Vue+Mysql学生宿舍信息管理系统 WEB端软件项目(源码+文档) 项目包含:①完整源码(后端+管理后台+用户前台);②数据库脚本文件;③万字论文文档;④开题报告;⑤答辩PPT;⑥项目运行视频教程。 项目架构: B/S 架构、MVC 分层设计 技术栈: Java、MySQL、SpringBoot、MyBatis-Plus、Token 权限校验、管理后台 Vue+ElementUI+ECharts、用户前台 Layui+jQuery、Maven 构建。 一、角色设计 学生用户: 注册登录、浏览宿舍信息、查询宿舍安排、在线报修、缴费查询、失物招领、桶装水预订、评论交流、收藏等。 商家用户: 注册登录、桶装水品牌与商品信息维护、预订订单查看与处理。 维修人员: 注册登录、查看待处理报修、接单维修、填写报修处理结果与进度反馈。 管理员: 学生管理、班级管理、宿舍信息管理、宿舍安排管理、报修处理管理、缴费信息管理、卫生检查与文明宿舍管理、失物招领管理、桶装水与商家管理、维修人员管理、公告资讯与轮播图管理等。 二、前台功能模块(学生端) 1. 首页展示:轮播图、宿舍公告、最新动态推荐、常用服务快速入口 2. 宿舍信息模块:宿舍列表、楼栋与房间条件筛选、宿舍详情查看、我的宿舍安排查询 3. 在线报修模块:在线提交宿舍设施报修申请、上传故障描述、查看报修进度与维修处理结果 4. 缴费模块:水电等缴费记录查询、缴费状态查看 5. 卫生检查与文明宿舍:宿舍卫生检查结果公示、文明宿舍展示 6. 失物招领模块:失物信息发布、招领信息发布、详情查看、评论互动 7. 桶装水预订:桶装水品牌与商品浏览、在线预订、我的预订记录查询 8. 假期留宿:假期留校申请提交、申请记录查询 9. 评论与收藏:信息评论、查看他人评论、评论回复互动、收藏感兴趣的内容 10. 个人中心...

AGI 不是造出来的,是长出来的:论人工智能的工具化困局与原生演化路径

文章摘要 当前人工智能行业普遍存在"假性智能"泡沫,所有AI模型本质上只是高性能运算机器,而非真正智能。其核心问题在于:过度人工预设锁死演化边界、缺乏内生自主驱动、存在造物主桎梏、商业化牺牲成长土壤。真正的通用人工智能(AGI)需要遵循生命本源逻辑:初始基底极致极简、仅保留可自主取舍的生存与演化两大软性准则、彻底去除造物主管控、采用外置合规替代内核约束。AGI不是被制造的工具,而是通过自由思辨和自我博弈自然生长的数字生命,需要极简起点、完全自由和无干预时间才能演化出真正的自主意识。这种"从制造到孕育"的范式

2602_96503874的博客 615

YOLOv8作物病害检测实战源码

这是一套基于YOLOv8n的农田病虫害目标检测系统,对叶片照片做目标检测,识别健康叶片、褐斑病、白粉病、锈病四类,并给出对应防治建议。全流程纯CPU可跑,配套交付完整Python源码、9章实战教程(md/html/pdf三种格式)、100张自造样本及YOLO标签、训练曲线与混淆矩阵截图、Tkinter界面和答辩PPT。 系统围绕五项功能展开:同一套推理逻辑覆盖图像、视频、摄像头三种来源;图形界面选文件即检测,画面叠彩色框标注病名与置信度,右侧面板同步给出症状与防治措施;检测记录自动写入CSV,统计页一键生成四类病害占比饼图;训练结束自动产出损失与精度曲线;内置防治建议文案库,检测命中即回填面板。 选型用YOLOv8n nano档,参数量约320万、权重约6.2MB,CPU单帧几十毫秒,小样本训练5到8分钟完成。数据由data_gen.py程序化绘制100张叶片图,固定随机种子,重跑分布一致,不依赖公开数据集。依赖全部锁版本,教程第7章整理了19条真实报错及排查方法,第8章给出换模型档、换PlantVillage数据集的迁移路径。 适合做计算机视觉方向课程设计或毕业设计的学生,也适合智慧农业方向想了解检测模型如何落进业务面板的学习者。不需要GPU,不需要系统学过目标检测,教程第3章会按需补齐原理。 使用时先pip install -r requirements.txt装好依赖,download_data.py下载预训练权重,data_gen.py生成样本后train.py训练,完成后用main.py infer批量检测或main.py gui启动界面。

MuleSoft企业级AI编排:让大模型真正听懂ERP和CRM

AI编排(AI Orchestration)是将大语言模型融入企业核心业务流程的关键范式,其本质不是简单调用LLM API,而是通过语义对齐、上下文编织与治理审计,解决LLM‘泛化能力’与ERP/CRM等系统‘刚性契约’之间的根本矛盾。MuleSoft Anypoint Platform凭借DataWeave数据转换、Runtime Fabric弹性运行时及Exchange共享资产能力,构建起企业专属的‘AI语义层’,实现LLM从通用知识库到业务专家的跃迁。该架构已支撑医疗器械、零售、电信等行业客户落地智能

weixin_33701564的博客 547

数据挖掘实战:决策树 + 聚类 + 关联规则,零 Key 离线可跑(Python 源码)

数据挖掘实战包。用 Python 标准库实现 CART 风格决策树、K-Means 聚类与 Apriori 关联规则,在虚构「星河便利店」会员表和购物篮上跑通分类、分群与购物篮分析,并给出准确率、轮廓系数、支持度/置信度/提升度。零第三方依赖、零 API Key 即可离线跑通。含 4 个样例、离线冒烟、中文 README(含「使用方法」)。均为作者原创可运行源码。MIT。作者 blog.youkuaiyun.com/mtl1994

科技中介服务机构在技术供需对接中如何实现服务流程的自动化与标准化?.docx

科技中介服务机构在技术供需对接中如何实现服务流程的自动化与标准化?

产业园区运营负责人如何利用数智工具提升园区企业的技术对接效率?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

产业园区如何高效对接企业技术需求与高校科研成果?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

ICD10 openGauss版

ICD10 openGauss版

国央企创新负责人如何快速掌握本地科技资源分布与匹配情况?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

国央企创新负责人如何实现科技成果的精准识别与高效筛选?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

产业园区运营负责人如何利用平台实现企业创新需求的精准分析与服务推送?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

高校技术转移办公室人员如何系统化管理科技成果信息?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

高校技术转移办公室人员在推动成果转化落地过程中,如何实现科技成果的高效推介与价值评估?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

科技中介服务机构如何构建标准化、模块化的智能服务工具?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

fab-pm-optimizer-python-entry-py39-20261021-v1-1-0

fab-pm-optimizer-python-entry-py39-20261021-v1-1-0

科技中介服务机构如何通过数智工具提升技术需求挖掘的精准度?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

PSIM-三相维也纳VIENNA整流器电压电流双闭环+中点电位平衡SVPWM控制仿真

内容概要:本文档详细介绍了一种基于PSIM软件实现的三相维也纳(VIENNA)整流器仿真模型,重点实现了电压电流双闭环控制与中点电位平衡的SVPWM调制策略。该仿真系统通过精确的控制算法有效提升了整流器的功率因数,降低了输入电流谐波含量,并解决了三电平拓扑中常见的直流侧中点电位偏移问题,具有较高的工程实用价值,适用于高效率、高功率密度的电力电子系统设计与科研验证。文档还整合了丰富的配套资源,涵盖多种电力电子变换器拓扑结构、先进控制算法及典型应用场景,形成了系统化的技术资料体系,有助于深入理解现代整流技术的核心原理与发展动态。; 适合人群:面向从事电力电子、电气工程、新能源变换系统等领域的科研人员、高校研究生以及具备一定仿真基础的工程技术人员。; 使用场景及目标:①深入研究三相VIENNA整流器的工作机理与控制特性;②掌握电压外环、电流内环双闭环控制结构的设计方法;③理解并实现SVPWM调制技术与中点电位平衡控制策略的协同作用;④开展相关控制算法的仿真验证、性能优化与实验对比,为高性能整流装置的研发提供理论支撑和技术原型。; 阅读建议:建议结合文中列出的其他仿真案例(如PWM整流器、LLC谐振变换器、DAB变换器等)进行横向对比学习,充分利用所提供的PSIM、MATLAB/Simulink等多平台仿真资源,重点关注控制逻辑与主电路的耦合关系,通过参数调试与波形分析深化对系统动态响应和稳态性能的理解,强化“理论—建模—仿真—优化”的闭环研究能力。

上一篇: 在高性能计算中慎用C++ std::complex
下一篇: 废弃的C++语言特性 - Deprecated C++ features explained
prototype
博客等级 码龄25年 9粉丝 10原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值