Talk:Inversion of control

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

May 2023 - confusion with dependency injection[edit]

I've edited both this and Dependency_Injection to address the fact that the two patterns are so frequently confused that people seem to have difficulty noticing they are two different patterns addressing two different concerns. — Preceding unsigned comment added by Chrisfcarroll (talkcontribs) 20:40, 25 May 2023 (UTC)[reply]

Good edits. The two patterns have become completely muddled, because "IoC" has also become used to refer to the much more specific practice that we now call DI. I've made a few changes to highlight the two different usages based on Fowler's history of the newer "dependency injection" / "inversion of control over dependencies" usage of the phrase. --Creamyhorror (talk) 09:46, 5 June 2023 (UTC)[reply]
Also, look at the "design purposes" of IoC in the article:
 Inversion of control serves the following design purposes:
   To decouple the execution of a task from implementation.
   To focus a module on the task it is designed for.
   To free modules from assumptions about how other systems do what they do and instead rely on contracts.
   To prevent side effects when replacing a module.
These points are actually the purposes of abstracting out code in general, rather than being IoC or DI-specific. You don't need DI to achieve these; you just need dependencies in the first place. These points belong in an article about abstraction of dependencies, not IoC or even DI. I think they should be moved out of this article. --Creamyhorror (talk) 09:51, 5 June 2023 (UTC)[reply]

Code example[edit]

The example is incomplete. While it does show how to refactor a facade into a proxy, it does not show a proper application of IoC (or SOLID in a broader sense). A proper example will use at least a couple classes and interfaces. A class diagram will be required to show readers the structure of the example. — Preceding unsigned comment added by 195.241.142.45 (talk) 09:51, 23 May 2014 (UTC)[reply]

What is good faith, and why is it negated?[edit]

Hey, just curious -- I attempted an edit of a section that was not only poorly written but contained two outside links to PDFs and places that no longer exist. This was rolled back by someone named Diego immediately with the description "good faith edit" and no explanation whatsoever. Now I'm just a random person who's found something in Wikipedia that they thought could be improved, and certainly opinions as to the quality of my edit can vary. Notwithstanding the links to nowhere, it's clear the paragraph in question was not written by a native English speaker because its syntax is muddled and its meaning is unclear (and may not even illuminate the ostensible subject; can't tell because the content linked to is no longer there). It should be fixed or deleted. I've read that the number of quality contributors to Wikipedia has been crashing in recent years, and if my experience today is any example, I think I may know why. 97.126.4.240 (talk) 05:13, 15 August 2016 (UTC)[reply]

I'm sorry that I have given you a bad first impression, I pride myself to try hard to not bite newcomers, but I have little internet time these days. You should expect that any edit you make may be reverted by other editor; it comes with the territory of an encyclopedia that anyone can edit, where anyone can disagree with what you did. It's even more likely if you edit without a user account, since we have to deal with lots of anonymous vandalism.
That a reference is not immediately available I'd not a reason to remove the content right there; as it's likely that there may be other sources supporting it. In the case of broken links, they get archived at archive. org and other services, so the proper way of action is to link to the archive. If you know how to fix the grammar, by all means do it. Diego (talk) 06:41, 16 August 2016 (UTC)[reply]
Since neither authors are citing Diff's to highlight the relevant edits, a neutral suggestion in this discussion would be to keep available references while deleting or correcting deadlinks. The situation faced by the first author is called a Link Rot and guidance on handling this is provided at WP:ROT. --Wikishagnik (talk) 12:24, 19 August 2017 (UTC)[reply]

External links modified[edit]

Hello fellow Wikipedians,

I have just modified one external link on Inversion of control. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 18 January 2022).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 23:21, 15 November 2017 (UTC)[reply]

Lead paragraph[edit]

@Licriss: Can we come to some understanding about what needs fixing and how that should happen? “Calls into” is a normal idiom in programming, distinct from “calls”. When one says “calls”, one means to invoke a function. When one says “calls into”, one implies that there is a body of code with entry points, and the caller makes use of those entry points (which might be a function from a table, for example). The call may get routed opaquely into some part of the code being called that the calling code has no notion of. Any particular instance of “calling into” is a “call”, but in aggregate, they are “calling into”. Strebe (talk) 22:05, 14 August 2023 (UTC)[reply]

@Strebe: Overall this article is unnecessarily verbose and jargon heavy, I was hoping for simple agreeable changes bit by bit as I get time but obviously failed at that.
Used in this sense "calls into" might be used by some but "calls" alone in reference to library code is also fine and has usage even in technical documents. You can call functions but you can also call other code, libraries and APIs, the benefit removing "into" here is it is also common in non-jargon grammar e.g. "I'm going to call my friend in France", "I'm going to call France", but most wouldn't say "I'm going to call into France"
We could simply say "uses libraries" for the first part though which would be both simpler and less contentious and maybe "makes calls to" for the second, which is also legitimate in both the common and jargon senses
Side note do you have an objection to changing "the code that expresses the purpose of the program" to just "the custom code"? Licriss (talk) 21:11, 23 August 2023 (UTC)[reply]
I wonder if we come out of different cultures of English idioms in programming. “Call a library” actually sounds wrong to me, which is interesting, because we do say “call France”. I don’t think anyone would be confused by removing “into”, although I also don’t think anyone would be confused by leaving it. “The custom code” is pithy and probably generally understandable, so I am fine with it, but this article has a history of squabbles over that explanation, and I think it used to be “custom code”. Strebe (talk) 00:59, 24 August 2023 (UTC)[reply]
@Strebe I can see it was "domain specific" and before that mentioned "compile time" vs "runtime" profiling, which would be understood by a much narrower audience than its current state.
I was tempted to put that the custom code "calls out" to the libraries in procedural and with inversion the libraries call into the custom code, for its illustrative effect, but I think the main idea is that the library controls the custom code, although this phrasing seems too casual and probably not clearer either i.e. "custom code uses generic code from external libraries, but with inversion the libraries are given control of the custom code"
I really think this comparison deserves a diagram but I'm not sure what would be an appropriate format for this page Licriss (talk) 20:27, 3 September 2023 (UTC)[reply]