Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Testing > Item 90. Don’t require more than you need to use in your ...

Item 90. Don’t require more than you need to use in your methods

Even if you are using good dependency injection (Item 89), keep the number of dependencies that you actually need to a minimum. Any more than a couple of dependencies will start to drive you insane and make your code unmaintainable.

Consider a module that checks your car’s license to ensure that it hasn’t expired. Maybe this Perl code lives in one of those automated cameras on traffic signals. The module doesn’t represent the automobile itself, but it can use an automobile object to access the license information:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial