V2EX  ›  英汉词典

Dependency Injection

释义 Definition

依赖注入:一种软件设计技术,把对象所依赖的组件(如服务、配置、数据库访问对象等)从外部“提供/注入”,而不是在对象内部自行创建,从而降低耦合、提升可测试性与可维护性。(常与 IoC(控制反转) 一起讨论。)

发音 Pronunciation (IPA)

/dɪˈpɛndənsi ɪnˈdʒɛkʃən/

例句 Examples

Dependency injection makes unit tests easier.
依赖注入让单元测试更容易。

In a large application, dependency injection helps you swap implementations (like a real payment service for a mock) without changing business logic.
在大型应用中,依赖注入能让你在不改业务逻辑的情况下替换实现(例如把真实支付服务换成模拟对象)。

词源 Etymology

dependency 源自拉丁语 dependere(“悬挂于、依靠”),引申为“依赖关系”;injection 来自拉丁语 inicere(“投入、注入”)。在软件工程语境中,“注入”是一个比喻:把“依赖项”像被“注入”一样交给对象使用。

相关词 Related Words

文学与作品 Literary Works

  • Dependency Injection in .NET — Mark Seemann
  • Clean Architecture — Robert C. Martin
  • Patterns of Enterprise Application Architecture — Martin Fowler
  • Growing Object-Oriented Software, Guided by Tests — Steve Freeman & Nat Pryce
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1150 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 16:19 · PVG 00:19 · LAX 08:19 · JFK 11:19
♥ Do have faith in what you're doing.