Understanding dependency injection