1 / 12

Inversion of Control with Castle Windsor

Inversion of Control with Castle Windsor. Daniel Hölbling http://www.tigraine.at tigraine@tigraine.at. Agenda. Why Inversion of Control Short intro of the problem Live coding session Using the Windsor Container. Scenario: Traffic watcher. Application that monitors Traffic.

kyle
Download Presentation

Inversion of Control with Castle Windsor

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. Inversion of Controlwith Castle Windsor Daniel Hölbling http://www.tigraine.at tigraine@tigraine.at

  2. Agenda • Why Inversion of Control • Short intro of the problem • Live coding session • Using the Windsor Container

  3. Scenario: Traffic watcher • Application that monitors Traffic. • Should send alarms in case of accident calls

  4. The TrafficWatcher Has nothing to do with notifying The only “real” responsibility.

  5. The Truth Construction Configuration Actual work

  6. Factory So and how are we supposed to test this? TrafficWatcherDEPENDS on Factory

  7. Dependency injection Notifier gets passed to Watcher No construction/retrieval in the TrafficWatcher Clean 

  8. Testable! Yay! We can test Trafficwatcher without any real Notifier

  9. Castle Windsor Container • A flexible component built to take care of object graph construction • There are other containers too: • Unity, StructureMap, nInject… in .NET • Guice, Loom, Pico... in Java • (rolling your own is rather simple )

  10. Coding Time forevenmorecode

  11. Suggestedreading • AyendeRahien (http://www.ayende.com) • Robert C. Martin • Martin Fowler(http://martinfowler.com/) • MiškoHevery (http://misko.hevery.com/) • Rob Conery (blog.wekeroad.com/) • CodeBetter.com

  12. Thanksforlistening! http://www.castleproject.org/container/ http://www.tigraine.at

More Related