Dependency Injection (DI)

Code Example

interface IOperation {
  void send();
}
 
class LowLevelModule: IOperation {
	@Override
  	public void send() {
    	//perform sending operation
  	}
}

class HighLevelModule {
  	private IOperation operation;
 
  	public HighLevelModule(IOperation operation) {
  		this.operation = operation;
  	}

  	public void Call() {
    	operation.Send();
  	}
}

Frameworks

Comparisons to Other Design Patterns

Resources