2
votes
1answer
52 views

Are the required parameters of a function called dependencies?

I'm studying dependency injection and I want to know if required function parameters can be considered dependencies. I'd just like to make sure before I go around referring to them dependencies and ...
1
vote
1answer
99 views

How to handle passing multiple dependencies in a module hierarchy

So I have my application consisting of a number of modules in a module hierarchy. Furthermore let's also assume each module is a class and we have a tree of classes where the classes at the top are ...
0
votes
1answer
73 views

Inject specific classes or not

I have a TableSqlBuilder interface which has a method getCreateTableSql. This interface is used in some other class as follows: function createTable( $tableDefinition ) { $sql = ...
30
votes
6answers
5k views

Should I use Dependency Injection or static factories?

When designing a system I am often faced with the problem of having a bunch of modules (logging, database acces, etc) being used by the other modules. The question is, how do I go about providing ...
8
votes
5answers
525 views

How to TDD test that objects are being added to a collection if the collection is private?

Assume that I planned to write a class that worked something like this: public class GameCharacter { private Collection<CharacterEffect> _collection; public void Add(CharacterEffect e) ...