-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust Inversion of Control definition #37
Conversation
6905c73
to
90d23dd
Compare
Inversion of control means that your application doesn't invoke something at all. Instead your application is invoked by the other thing. Hence the Hollywood principle. You don't invoke the lower layers, they invoke you. For a long time, if you wanted to build a web service, you needed to write code that would listen on a socket, parse an incoming message, then do something useful with that. In other words, your code controlled the whole stack. In modern frameworks, the control is inverted: you register a handler to a URL, and you get called when it's time to do some work. This is true of many kinds of framework. It's so ubiquitous that you probably don't think of there being any alternative. I would gently repeat the advice to just not mention IOC at all. This definition is incorrect and you'll get snarky issues forevermore demanding that you reword things. |
What do you see as incorrect about it Bob? Everything you say is what I mean too. Perhaps it's the use of the word 'program'. An application is running both custom and framework code, so one way of seeing it is that the framework bit of the application is calling the custom bit indirectly. But perhaps it's a confusing way of putting it. Mentioning frameworks is just an example. The important thing IMO is the indirect invocation, IoC could happen within a framework just as much as between a framework and custom code. My vote would be to keep trying for a definition. It's not a complicated idea, it's useful for people to understand, it's just that we don't have a precise common language to talk about it with, IMO. |
Alright, I've meditated over this and I think I have a compromise that maybe everyone can live with by using a relevant example and adding a bunch of weasel words:
|
Personally I would change 'higher-level code (business logic)' just to 'custom code'.
'for' -> 'is'? Otherwise, I like it! |
Summary
Adjusts the IoC glossary definition as per our discussion offline.
IMO the existing definition isn't quite right, inversion of control is a broader concept not limited to relationships between I/O logic and business logic.
Pull Request Check List
docs/core-concepts.md
or one of the integration guides by hand.versionadded
,versionchanged
, ordeprecated
directives..rst
and.md
files is written using semantic newlines.