a quick discourse on dependency injection

April 25, 2011
  • +1 : less boilerplate code for component initialization
  • -1 : boilerplate code can be reduced by moving initialization to library + app-specific conf
  • +1 : DI might provide standardized way to do so – valuable especially for common components such as db
  • +1 : Easy to provide mock implementations -> supporting testing (separate setup for conf)
  • -1 : More difficult to debug / trace issues
  • -1 : As flexibility is added to the interaction with injected object – the complexity of debugging increases
  • +1 : But components can be tested in isolation and covered with tests
  • -1 : Though this definitely introduces longer development time. Great on off-the shelf components but challenge for one-off custom code
  • -1 : Promotes IDE dependency for developers (no more emacs)
  • ….
  • summary: A priori usage of dependency injection without proper justification can come at the price
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: