1 / 10

Dependency Injection and Model-View-Controller

Dependency Injection and Model-View-Controller. Overview. Inversion of Control Model-View-Controller. Why Inversion of Control?. Procedural logic leads to tight coupling to particular implementations Inversion of control pushes logic to the lower application layers

ally
Download Presentation

Dependency Injection and Model-View-Controller

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dependency Injection and Model-View-Controller

  2. Overview Inversion of Control Model-View-Controller

  3. Why Inversion of Control? Procedural logic leads to tight coupling to particular implementations Inversion of control pushes logic to the lower application layers Essential coupling remains

  4. Binding to Concrete Instances Factory instantiation Constructor instantiation Configuration based instantiation

  5. Dependency Injection Container Injection Runtime binding Facilitates testing Simpler than factory construction? Looser coupling

  6. Simple Container Example Plug-in Manager Type is requested Lookup for type to be loaded Reflection used to find the type Instantiates an instance and returns it Test and Code use different Data Mapper

  7. Dependency Injection Problems Complex level of indirection Code can be difficult to read and understand Use at component boundaries Level of testing is an economic judgment

  8. Model View Controller Separate user interface from business logic Model has no User Interface interaction Controller handles input events from user interface View represents the appropriate display of the model

  9. Advantages of MVC User interfaces are hard to test Keeps UI level small Makes business logic easier to test UI can be modified without affecting business logic

  10. Summary Inversion of Control minimizes coupling dependency injection for runtime control Model View Controller decouples UI from business logic flexible testing and evolution

More Related