15.01.2013 Views

Foundations of Programming - Karl Seguin

Foundations of Programming - Karl Seguin

Foundations of Programming - Karl Seguin

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4 - Dependency Injection<br />

In This Chapter<br />

Reducing coupling is one <strong>of</strong> those things that’s pretty easy to do yet yields great results towards our<br />

quest for greater maintainability. All that’s required is a bit <strong>of</strong> knowledge and discipline – and <strong>of</strong> course,<br />

tools don’t hurt either. It should be obvious why you want to decrease the dependency between the<br />

components <strong>of</strong> your code – especially between those components that are responsible for different<br />

aspects <strong>of</strong> the system (UI, Domain and Data being the obvious three). In the next chapter we’ll look at<br />

unit testing which will really leverage the benefits <strong>of</strong> dependency injection. If you’re having problems<br />

wrapping your head around DI, take a look at my more detailed article on the subject located on<br />

DotNetSlackers.<br />

<strong>Foundations</strong> <strong>of</strong> <strong>Programming</strong> Copyright © <strong>Karl</strong> <strong>Seguin</strong> www.codebetter.com<br />

33

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!