Инверсия управления и шаблон внедрение зависимости

Martin Fowler, “Inversion of Control Containers and the Dependency Injection pattern”, public translation into Russian from English More about this translation.

See also one similar translation

Translate into another language.

Participants

Bishop183 points
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated

Inversion of Control Containers and the Dependency Injection pattern

Инверсия управления и шаблон внедрение зависимости

History of edits (Latest: Bishop 1 year ago) §

In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use.

Last significant update: 23 Jan 04

Последнее значительное обновление: 23 января 2004

History of edits (Latest: Bishop 1 year ago) §

Contents

Содержание

History of edits (Latest: Bishop 1 year ago) §

Components and Services

Компоненты и службы

History of edits (Latest: Bishop 1 year ago) §

A Naive Example

Наивный пример

History of edits (Latest: Bishop 1 year ago) §

Inversion of Control

Инверсия управления

History of edits (Latest: Bishop 1 year ago) §

Forms of Dependency Injection

Constructor Injection with PicoContainer

Setter Injection with Spring

Interface Injection

Using a Service Locator

Using a Segregated Interface for the Locator

A Dynamic Service Locator

Using both a locator and injection with Avalon

Deciding which option to use

Service Locator vs Dependency Injection

Constructor versus Setter Injection

Code or configuration files

Код или конфигурационные файлы

History of edits (Latest: Bishop 1 year ago) §

Separating Configuration from Use

Отделение конфигурации от использования

History of edits (Latest: Bishop 1 year ago) §

Some further issues

Concluding Thoughts

Заключительные мысли

History of edits (Latest: Bishop 1 year ago) §

One of the entertaining things about the enterprise Java world is the huge amount of activity in building alternatives to the mainstream J2EE technologies, much of it happening in open source. A lot of this is a reaction to the heavyweight complexity in the mainstream J2EE world, but much of it is also exploring alternatives and coming up with creative ideas. A common issue to deal with is how to wire together different elements: how do you fit together this web controller architecture with that database interface backing when they were built by different teams with little knowledge of each other.A number of frameworks have taken a stab at this problem, and several are branching out to provide a general capability to assemble components from different layers. These are often referred to as lightweight containers, examples include PicoContainer, and Spring.

Pages: ← previous Ctrl next next untranslated

© © Copyright Martin Fowler, all rights reserved.