Comments (7)
Does this answer your question? http://stackoverflow.com/a/9503612/126014
from ploeh.github.com.
I don't think so.
As far as I know, dependency inversion is, because doing some task and creating instances of the dependencies in the same class would violate the single responsibility principle. So because of this we have to inject the dependencies and create classes (one or more DI container) with the task of instantiating classes...
Maybe I just misunderstood one of your graphs. The arrow from the data access library to the domain library means to me, that the domain library will be injected with dependency injection to the data access library. This is unusual to me. If I want to save something in my database I want to ask the database to save it for me, not for example trigger a persist event and listen to those events from the database... But this invertion of yours says that to me :S I am confused...
from ploeh.github.com.
The arrows describe references, so in this case it means that the Domain Library has references to neither User Interface Library nor Data Access Library. Instead, the Data Access Library has a references to the Domain Library.
At run-time, the objects from the Domain Library will be injected with objects from the Data Access Library, so that they can invoke their services.
This is unusual to me. If I want to save something in my database I want to ask the database to save it for me, not for example trigger a persist event and listen to those events from the database... But this invertion of yours says that to me
Well, there's a reason it's called Inversion of Control :)
Have you read my book?
from ploeh.github.com.
Not yet, I don't have time to read books. :S I just found your blogpost...
Are you aware, that ppl uploaded your book to several sites?
from ploeh.github.com.
At run-time, the objects from the Domain Library will be injected with objects from the Data Access > Library, so that they can invoke their services.
Hmm so the domain library is aware of the data access library objects (maybe just interfaces). It's okay then, I just misunderstood. In my approach the classes in the layers/modules do not know of the existence of each other, and a DI container instantiates and injects them into each other whenever it is necessary...
from ploeh.github.com.
Thanks for the heads-up!
from ploeh.github.com.
You're welcome!
from ploeh.github.com.
Related Issues (20)
- [Suggestion] GitHub comments in place of Pull Requests HOT 3
- Type in today's blog post? HOT 1
- December 31, not January... ;) HOT 1
- Forward links to impureim sandwich HOT 1
- Commenting HOT 1
- [Translation] a post translation HOT 5
- 'At the boundaries, applications aren't functional' - just a question HOT 2
- What of streams? HOT 2
- suggestion: use utterances for github-based comments HOT 2
- Please make it easier to write comments HOT 6
- Subscribe to the blog? HOT 8
- Comment on "Use Git tactically" on the StackOverflow blog HOT 4
- Auto-generate values with Hedgehog HOT 5
- Dark mode HOT 3
- Clickable anchors for comments HOT 5
- Semantic section markup HOT 1
- There seems to be a problem in this article (Kleisli composition) HOT 5
- Infinite Enumerables in C# HOT 3
- Service compatibility is determined based on policy HOT 1
- re "Fitting a polynomial to a set of points" - why you "failed to accomplish what I set out to do"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ploeh.github.com.