[ Team LiB ] |
![]() ![]() |
Chapter 6. Implementation ConsiderationsIN THIS CHAPTER
In this chapter, we apply what we have learned through prototyping and examples to finalize the design for the image framework. The components of the framework are shown in Figure 6.1. Figure 6.1. Image Framework Components
Our design has had many iterations, using a variety of C++ techniques. We started by using inheritance to create a framework that could handle numerous image types. It quickly became apparent in our subsequent prototype that templates both improved and simplified the design by eliminating most of the object hierarchy. However, we were still including image storage as a component of the image class, instead of separating it as an image component. We also explored using handles, but found they did nothing to improve the design. Once we prototyped a solution that separated storage from the image class, we knew that the final design was close at hand. Each prototype was incomplete, but collectively they allowed us to test different design principles. We used a single, trivial, image processing function (computing thumbnail images) to observe the merits of each design. And, we wrote a unit test for each prototype to verify the correctness and the behavior of memory allocation, and to verify how pixels are accessed. Often, the final design grows out of one or more prototypes. Sometimes it is obvious that you have hit on the right design, and other times it becomes an iterative process. From our prototypes, we applied the following ideas:
![]() |
[ Team LiB ] |
![]() ![]() |