About Moving the ReturnType Argument to the Interfaces

[Previous] [Next]

Earlier in this chapter, we showed you how you could generalize certain interfaces. We created one set of interfaces that returned ADO recordsets and another set that returned XML documents to their respective clients. We also showed you how many main business classes could use the same set of generalized interfaces. Figure 9-17 shows how you can take this idea of using generalized interfaces one step further. In the Rose diagram displayed in this figure, we've gone entirely to generalized interfaces. We didn't provide one set of interfaces for XML and another for ADO recordsets; there's only one set. Methods of those generalized interfaces have the intReturnType argument, which allows clients to specify what they want in return.

click to view at full size.

Figure 9-17. The IMaint and IViewer interfaces now support different return types. They accept Variants in return, and they specify what they want with the intReturnType argument.

When we first designed this application, this is the set of interfaces we came up with and worked with for a while. We generated code for this design, and we manually enhanced the code we generated and made it perform the job it was supposed to. But we found that the idea of supergeneralized interfaces forced us to create complicated code, which made us begin to dislike the whole idea. But we still want to share it with you, if only to show you how far an idea can take you. This one has gone too far. But that's OK because when an idea has taken you far enough to let you see that the result wasn't worth the trip, you can go back again and take another route.

We come back to the issue of interfaces and their implementations in Chapter 11, "Making It Simpler." But before doing that, we want to use the next chapter to create real implementation code for the facades, moving our test stub code to the main business classes, because doing that will help us prove an important point when we arrive at Chapter 11.



Designing for scalability with Microsoft Windows DNA
Designing for Scalability with Microsoft Windows DNA (DV-MPS Designing)
ISBN: 0735609683
EAN: 2147483647
Year: 2000
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net