Meeting 5: Unterschied zwischen den Versionen
K (→Springframework) |
|||
Zeile 3: | Zeile 3: | ||
'''Where''': [http://www.wegweiser.ac.at/tuwien/hoersaal/F4.html Freihaus HS4] | '''Where''': [http://www.wegweiser.ac.at/tuwien/hoersaal/F4.html Freihaus HS4] | ||
− | |||
− | |||
==Inversion of Control== | ==Inversion of Control== | ||
− | |||
Download the [[Media:JSUG-Inversion of Control-Florian Motlik.pdf|slides]] (pdf, 38KB). | Download the [[Media:JSUG-Inversion of Control-Florian Motlik.pdf|slides]] (pdf, 38KB). | ||
+ | |||
+ | |||
+ | [[Benutzer:Matlock|Florian Motlik]] introduced todays topic IoC, which follows the slogan "don't call us, we'll call you". Your code just implements the specific logic but the actual control itself is passed to a certain controller class. A trivial example would be iterating over a collection. | ||
+ | |||
+ | |||
+ | Instead of writing ... | ||
+ | |||
+ | <code> | ||
+ | var someList = [ "Larry", "Curly", "Moe" ]; | ||
+ | for(var i = 0; i < someList.length; i++) { | ||
+ | var name = someList[i]; | ||
+ | println(name.length); | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ... one could just say ... | ||
+ | |||
+ | <code> | ||
+ | [ "Larry", "Curly", "Moe" ].each { name | println(name.length)} | ||
+ | </code> | ||
+ | |||
+ | ... and that's all. By passing a function to a certain method provided by the datastructure itself (make use of closures), the actual iterating over each field is hidden and you don't have to worry about it anymore; your could will be invoked for each item, and therefore control is inverted. | ||
+ | |||
+ | |||
+ | '''Dependency injection''' (originally introduced by [http://martinfowler.com/articles/injection.html Martin Fowler]) is a specific form of IoC. Dependencies of a class will be injected for you (constructor/setter/field injections are possible) and therefore the coupling is not necessarily reduced, but its shifted outside the code (in case of Spring into a XML file). | ||
+ | |||
==Guice== | ==Guice== | ||
− | |||
Download the [[Media:Google_Guice.pdf|slides]] (pdf, 115KB).<br /> | Download the [[Media:Google_Guice.pdf|slides]] (pdf, 115KB).<br /> | ||
Download the [[Media:Jsug-guice-demo-project.zip|sourcecode]] (pdf, 13KB). | Download the [[Media:Jsug-guice-demo-project.zip|sourcecode]] (pdf, 13KB). | ||
+ | |||
+ | ===Content=== | ||
+ | Held by [[Benutzer:Comar|Jan Zarnikov]] | ||
+ | |||
+ | ===Links=== | ||
+ | |||
+ | * [http://code.google.com/p/google-guice/ http://code.google.com/p/google-guice/] ... Official Guice website | ||
== Springframework == | == Springframework == | ||
− | |||
Download the [[Media:JSUG-Slides_Spring_Christoph_Pickl.pdf|slides]] (pdf, 0.6MB). | Download the [[Media:JSUG-Slides_Spring_Christoph_Pickl.pdf|slides]] (pdf, 0.6MB). | ||
+ | |||
+ | ===Content=== | ||
+ | Held by [[Benutzer:Christoph.pickl|Christoph Pickl]]. | ||
=== Links === | === Links === | ||
Zeile 26: | Zeile 57: | ||
* [http://parleys.com/display/PARLEYS/Home#talk=18612266;slide=1;title=Comparing%20Dependency%20Injection%20Frameworks Comparing Dependency Injection Frameworks] - Short presentation at [http://parleys.com/ parelys.com] | * [http://parleys.com/display/PARLEYS/Home#talk=18612266;slide=1;title=Comparing%20Dependency%20Injection%20Frameworks Comparing Dependency Injection Frameworks] - Short presentation at [http://parleys.com/ parelys.com] | ||
− | |||
− | |||
− | =Gallery= | + | ==Gallery== |
<gallery> | <gallery> | ||
Bild:Meeting5 picture1.jpg|Sun representative Ivan and Florian Motlik | Bild:Meeting5 picture1.jpg|Sun representative Ivan and Florian Motlik | ||
Zeile 36: | Zeile 65: | ||
</gallery> | </gallery> | ||
− | Thanks to Jan | + | Thanks to Jan for providing these pictures. |
+ | |||
[[Category:Meeting]] | [[Category:Meeting]] |
Version vom 14. Januar 2009, 12:58 Uhr
When: Monday, October 13th, 2008 - 19:00
Where: Freihaus HS4
Inhaltsverzeichnis
Inversion of Control
Download the slides (pdf, 38KB).
Florian Motlik introduced todays topic IoC, which follows the slogan "don't call us, we'll call you". Your code just implements the specific logic but the actual control itself is passed to a certain controller class. A trivial example would be iterating over a collection.
Instead of writing ...
var someList = [ "Larry", "Curly", "Moe" ]; for(var i = 0; i < someList.length; i++) { var name = someList[i]; println(name.length); }
... one could just say ...
[ "Larry", "Curly", "Moe" ].each { name | println(name.length)}
... and that's all. By passing a function to a certain method provided by the datastructure itself (make use of closures), the actual iterating over each field is hidden and you don't have to worry about it anymore; your could will be invoked for each item, and therefore control is inverted.
Dependency injection (originally introduced by Martin Fowler) is a specific form of IoC. Dependencies of a class will be injected for you (constructor/setter/field injections are possible) and therefore the coupling is not necessarily reduced, but its shifted outside the code (in case of Spring into a XML file).
Guice
Download the slides (pdf, 115KB).
Download the sourcecode (pdf, 13KB).
Content
Held by Jan Zarnikov
Links
- http://code.google.com/p/google-guice/ ... Official Guice website
Springframework
Download the slides (pdf, 0.6MB).
Content
Held by Christoph Pickl.
Links
- springframework.org - Official Website
- Comparing Dependency Injection Frameworks - Short presentation at parelys.com
Gallery
Thanks to Jan for providing these pictures.