View on GitHub

Bearded-android-docs

InversionOfControl

Download this project as a .zip file Download this project as a tar.gz file

Created Thursday 12 December 2013

There is some argument as to what Inversion of Control means. As per Martin Fowler, Inversion of Control = Dependency Injection:

The Inversion of Control (IoC) (aka Dependency Injection [DI]) pattern is about removing dependencies from your code.

public class TextEditor
{
    private ISpellChecker checker;
    public void checkSpelling()
    {
	//...
        checker.check();
	//...
    }
}

The inversion is how the code lookups up the ISpellChecker implementation.
There are several ways to achieve dependency injection:


Backlinks:

OOP:RefactoringLegacyCode:IntroduceStaticSetter OOP:RefactoringLegacyCode:SupersedeInstanceVariable
comments powered by Disqus