From 55c7473b6fefa6a160d1e5fbe90005d1a385b93f Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Fri, 7 Oct 2016 17:32:24 +0300 Subject: [PATCH] Update readme --- README.rst | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/README.rst b/README.rst index f1055937..b84ac079 100644 --- a/README.rst +++ b/README.rst @@ -42,13 +42,6 @@ Status | | :alt: Coverage Status | +---------------------------------------+----------------------------------------------------------------------------------------+ -Installation ------------- - -*Dependency Injector* library is available on `PyPi`_:: - - pip install dependency_injector - Dependency Injection -------------------- @@ -65,14 +58,20 @@ Dependency injection pattern has few strict rules that should be followed: injector) the responsibility of providing its dependencies - object **B** (the service). + The client doesn't know how to create the service, it knows only interface - of service. -+ The service doesn't know that it is used by the client. -+ The dependency injector knows how to create the client. -+ The dependency injector knows how to create the service. -+ The dependency injector knows that the client depends on the service. -+ The dependency injector knows how to inject the service into the client. -+ The client knows nothing about the dependency injector. -+ The service knows nothing about the dependency injector. + of service. The service doesn't know that it is used by the client. ++ The dependency injector knows how to create the client and the service, it + also knows that the client depends on the service, and knows how to inject + the service into the client. ++ The client and the service know nothing about the dependency injector. + +Dependency injection pattern provides next advantages: + ++ Control on application structure. ++ Decreased coupling between application components. ++ Increased code reusability. ++ Increased testability. ++ Increased maintainability. ++ Reconfiguration of system without rebuilding. Next two examples demonstrate refactoring of a small piece of code to dependency injection pattern: @@ -123,18 +122,6 @@ realistic, right? engine = Engine() # Application creates Engine's instance car = Car(engine) # and inject it into the Car's instance -Advantages of dependency injection ----------------------------------- - -Dependency injection pattern provides next advantages: - -+ Control on application structure. -+ Decreased coupling between application components. -+ Increased code reusability. -+ Increased testability. -+ Increased maintainability. -+ Reconfiguration of system without rebuilding. - Example of dependency injection ------------------------------- @@ -293,6 +280,13 @@ GitHub: https://github.com/ets-labs/python-dependency-injector +Installation +------------ + +*Dependency Injector* library is available on `PyPi`_:: + + pip install dependency_injector + Documentation -------------