From: Nat P. <nat...@b1...> - 2003-12-18 11:09:50
|
On Wed, 2003-12-17 at 23:02, J. Xue wrote: > my code has had some strong assumption on the usage of castor. > Would it then still be architecturally reasonable and natural to introduce an > adapter that essentially duplicates the castor unmarshaller interface for the > sole purpose of plugging in MO's? Your object should make use of interfaces that make sense to it, not that are defined by technology that you have chosen. This is what mock objects are good for: in TDD they drive the design of an object's *required* interfaces. Your object needs to unmarshall some data from some input stream. The interface should express that. An implementation of the interface can use the castor API. But if you drive the design of the interface from the needs of your object, not from your choice of castor, then it will be easy to change your choice of XML API later if you want. Using mock objects to drive the design of the interactions between your objects will naturally lead to such "flex points" in your design. Cheers, Nat. |