JSUG - Inversion Of Control by Florian Motlik

  • 323 views
Uploaded on

visit http://jsug.fsinf.at

visit http://jsug.fsinf.at

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
323
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
7
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Inversion of Control Dependency Injection Florian Motlik 13.10.2008 JSUG - Treffen 1 WS 08/09
  • 2. Inversion of Control Don't call us, we call you. Trennung Kontrolle und Ausführung Generische Kontrollklasse und spezifische Implementierung Iterator vs Code Block/Closure stooges = ['Larry', 'Curly', 'Moe'] foreach (stooge in stooges) {print stooge + quot;nquot;} Kontrolle der Iterierung in Hand des Programmierers stooges.each {|stooge| print stooge + quot;nquot;} each Methode kontrolliert Iterierung. Interne Iterierung. Event-driven programming - z.B. Swing Gui Listener
  • 3. Dependency Injection Anwendung von IOC Kontrolle über Dependencies Kopplung von App zu SortImpl verringern Kein direkter Aufruf eines SortImpl Konstrukturs Sorter wird quot;Injectedquot; in App durch Framework Setter & Constructor based Injection
  • 4. Vorteile/Nachteile Vorteile Weniger Abhängigkeiten (Kapselung) Kein lookup Code nötig Zwang zu Interfaces -> bessere Struktur Test/Run Konfiguration möglich und nur einmal zu machen. Nachteile Möglicherweise viel Konfiguration (XML Hell) Zusätzliches Framework Abhängigkeiten zum Framework (vermeidbar) Refaktorisierung umständlich/fehleranfällig (IDE) Weniger Code Transparenz
  • 5. Links http://en.wikipedia.org/wiki/Dependency_injection http://en.wikipedia.org/wiki/Inversion_of_control http://en.wikipedia.org/wiki/Strategy_pattern http://en.wikipedia.org/wiki/Closure_(computer_science) http://martinfowler.com/articles/injection.html Licensed under CreativeCommons Attribution + ShareAlike (by-sa) http://creativecommons.org/licenses/by-sa/3.0/at/