Chapter 4. Building modular applications

 

This chapter covers:

  • Organizing code in modules
  • Watching out for tight coupling
  • Designing with loose coupling
  • Testing code in discrete units
  • Working with key rebinding

“To define it rudely but not ineptly, engineering is the art of doing that well with one dollar, which any bungler can do with two after a fashion.”

Arthur Wellesley

So far, we’ve looked at what it means for objects to be well behaved and classes to be well designed in the small. But in any real-world project, there’s also a big picture to be considered. Just as there are principles that help our design of objects in the micro, there are principles for good design in the macro sense. In the coming sections, we’ll talk about these design principles and see how to relate them to dependency injection.

Chief among these is testing. DI facilitates testing and testable code, the latter being an extremely important and often-overlooked condition to successful development. Closely tied to this is the concept of coupling, where good classes are linked to the dependencies in ways that facilitate easy replacement and therefore testing—bad ones are not. We’ll see how to avoid such cases, and finally we’ll look at the advanced case of modifying injector configuration in a running application.

First, let’s start at in the micro level and explore the role objects play as the construction units of applications.

4.1. Understanding the role of an object

 
 

4.2. Separation of concerns (my pants are too tight!)

 

4.3. Testing components

 
 

4.4. Different deployment profiles

 
 

4.5. Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage