cleanup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cleanup

代码清理

Look over the current change (or the whole codebase if there is no current change) and look for:
  • Any transformations or indexes that are redundant with data structures or relationships already known earlier in the whole-program data flow.
  • Any backwards-compatibility shims, unnecessary defensive code, or unnecessary deduplication.
  • For any deduplication added in this change, ask yourself: could these objects have arrived here inherently deduplicated?
Print out your findings, if any. Then, fix any findings you found.
After fixing your findings, look over the code again: now that we have done that cleanup, are there any other cleanups available? Print out your new findings. Then fix them.
Continue to do that in a loop (look over the code again, find any new cleanups that are visible now that you've fixed the last ones, print them out, and fix them if you find any) until you find no more cleanups to do upon reinspection.
检查当前变更(如果没有当前变更则检查整个代码库),并寻找以下内容:
  • 任何与整个程序数据流中已知的早期数据结构或关系重复的转换或索引。
  • 任何向后兼容的垫片、不必要的防御性代码或不必要的重复消除。
  • 对于本次变更中添加的任何重复消除,请自问:这些对象是否本来就可以无重复地到达这里?
如果有发现,请列出你的结果。然后修复你发现的问题。
修复完成后,再次检查代码:现在我们已经完成了清理,是否还有其他可以清理的内容?列出你的新发现。然后修复它们。
重复此循环(再次检查代码,找出修复上一批问题后新出现的可清理项,列出结果,如果有则修复),直到重新检查时没有发现更多可清理项为止。