Dependency injection

[Google Scholar] [Wikipedia]

Notes: testability, test driven development, test double

Technique to make code more flexible mostly used for testing. Consists of replacing hardcoded dependencies with parameters so that the caller/creator has control over which object/function is called. e.g., instead of writing to stdout, pass a file handle to write to or, better yet, pass an object that the code can write to.

See also Dependency inversion principle (wikipedia).