V2EX  ›  英汉词典

Code Refactoring

定义 Definition

代码重构:在不改变外部可观察行为(功能不变)的前提下,调整和改进代码的结构与设计,以提升可读性、可维护性、可扩展性,并减少重复与潜在缺陷。(也常用于降低“技术债”、消除“坏味道”。)

发音 Pronunciation (IPA)

/koʊd ˌriːˈfæk.tər.ɪŋ/

例句 Examples

I spent the afternoon doing code refactoring to make the functions easier to read.
我花了一下午做代码重构,让这些函数更容易读懂。

After the team added automated tests, they began a careful code refactoring effort to reduce technical debt without breaking existing features.
在团队加入自动化测试之后,他们开始谨慎地推进代码重构,以在不破坏现有功能的前提下降低技术债。

词源 Etymology

refactor 来自前缀 re-(“再次、重新”)+ factor(“因素/构成部分;做分解处理”相关概念)。在软件工程语境中,refactoring 指“重新组织代码的构成方式”,强调结构优化而非新增功能。该术语在 1990 年代随面向对象设计与工程实践普及而广泛流行,尤其因 Martin Fowler 等人的总结而被系统化。

相关词 Related Words

文学与著作中的用例 Literary Works

  • Refactoring: Improving the Design of Existing Code(Martin Fowler)——核心主题即重构,系统提出重构方法与“重构目录”。
  • Clean Code(Robert C. Martin)——反复强调通过重构改进可读性与设计质量。
  • Working Effectively with Legacy Code(Michael Feathers)——讨论在遗留系统中通过测试护航进行重构。
  • The Pragmatic Programmer(Andrew Hunt & David Thomas)——将重构作为日常工艺与持续改进的重要实践。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1424 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 16:17 · PVG 00:17 · LAX 08:17 · JFK 11:17
♥ Do have faith in what you're doing.