Design Patterns: Basics of Dependency Injection

What is Dependency Injection?

It is very common that you will instantiate an objects properties or internal members to some value other than null within the objects constructor; thus setting up the object for use when it is created. These values are considered “dependencies” since the object depends on them in order to function. The pattern at its most basic is just passing in these dependencies to the objects constructor instead of instantiating them directly within the objects constructor. By doing this you can change the objects dependencies without needing to modify, refactor or inherit the class. Also, dependency injection doesn’t rely on IoC and can be used without it.

Thanks to Chris Pietschmann(http://pietschsoft.com). Pls visit the below url more details.

http://pietschsoft.com/post/2012/04/13/Design-Patterns-Basics-of-Dependency-Injection.aspx

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s