Download - The Zen of IoC
![Page 2: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/2.jpg)
back to basics (1968)
![Page 3: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/3.jpg)
coupling: bad
![Page 4: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/4.jpg)
cohesion: good
![Page 5: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/5.jpg)
now, things evolve…
![Page 6: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/6.jpg)
SOLID OOPMulti-layerTDDinterfacesmockingSOA
patternsFAIR
refactoring
OODframeworks
interop
polymorphism
inheritance
encapsulation
![Page 7: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/7.jpg)
so, nowadays...
![Page 8: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/8.jpg)
cohesion: good
![Page 9: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/9.jpg)
coupling: bad
![Page 10: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/10.jpg)
a subtle case of coupling
![Page 11: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/11.jpg)
var repo = new UserRepository();var users = repo.GetAll();
coupling here
![Page 12: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/12.jpg)
constructor coupling blues
I can’t test this thing!
What? This test hits the database?!?
But this new class implements this interface!
This refactoring will take ages…
How do I link this view and controller?
![Page 13: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/13.jpg)
enter IoC
![Page 14: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/14.jpg)
IoC is a concept(what)
![Page 15: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/15.jpg)
DI is a pattern(how)
![Page 16: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/16.jpg)
injection through construction
lifetime
dependency
concurrency safe
simplest approach
![Page 17: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/17.jpg)
injection through properties
simpler
construction
flexible injection
concurrency risks
![Page 18: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/18.jpg)
injection through interfaces
flexible injection
concurrency risks
equivalent to props
harder setup
![Page 19: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/19.jpg)
the evil twin
![Page 20: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/20.jpg)
service locator
lifecycle controlsmaller contractsconcurrency riskstesting is a b*
![Page 21: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/21.jpg)
tools of the tradeCastle WindsorUnityNInjectSimpleInjector
![Page 22: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/22.jpg)
consequences
![Page 23: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/23.jpg)
dude, where’s my code?
![Page 24: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/24.jpg)
ramping + tooling
![Page 25: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/25.jpg)
smell: lots of dependencies
![Page 26: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/26.jpg)
man, your code already sucks
![Page 27: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/27.jpg)
risk: interfaces abound
![Page 28: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/28.jpg)
grain of salt + refactoring
![Page 29: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/29.jpg)
risk: locators everywhere
![Page 30: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/30.jpg)
KISS
![Page 31: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/31.jpg)
natural pluggable design
![Page 32: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/32.jpg)
overdriven Liskov
![Page 33: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/33.jpg)
easy mocking
![Page 34: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/34.jpg)
great enabler for tdd
![Page 35: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/35.jpg)
issue: DDD & IoC mismatch
![Page 36: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/36.jpg)
no easy way out
![Page 37: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/37.jpg)
interception easily doable
![Page 38: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/38.jpg)
added flexibility
![Page 39: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/39.jpg)
good-bye to singletons
![Page 40: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/40.jpg)
let the container handle this
![Page 41: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/41.jpg)
tks.
![Page 42: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/42.jpg)
zen quotesBeing a spectator while one is also a participant spoils one's performance.
Everything exists in relation to other things.
In emptiness, forms are born. When one becomes empty of the assumptions,inferences, and judgments he has acquired over the years, he comes close to his original nature and is capable of conceiving original ideas and reacting freshly.
Security and changelessness are fabricated by the ego-dominated mind and do not exit in nature. To accept insecurity and commit oneself to the unknown creates a relaxing faith in the universe.
True insight does not issue from specialized knowledge, from membership in coteries, from doctrines or dogmas. It comes from the preconscious intuitions of one's whole being, from one's own code.
![Page 43: The Zen of IoC](https://reader033.vdocument.in/reader033/viewer/2022052321/5403b6ff8d7f72e04c8b48b4/html5/thumbnails/43.jpg)
fowler on IoC:
http://martinfowler.com/articles/injection.html
http://martinfowler.com/bliki/InversionOfControl.html
interception on SI:
http://simpleinjector.codeplex.com/wikipage?title=InterceptionExtensions
IoC x anemic DM
http://
programmers.stackexchange.com/questions/72768/does-inversion-of-control-pr
omote-anemic-domain-model
image source:
http://photopin.com