Mock Implementation Becomes Component Interface

Goal: Minimize the effort of component development overhead during initial development phase.

Rationale: When designing a component based solution you want to focus on program structure and business functions instead of getting down to the nitty-gritty of component based development. You also want the opportunity to play around with the structure and interfaces without the extra effort of re-deploying etc.

Solution: Following the principle DoTheSimplestThingThatCouldPossiblyWork, you start out small and create a dummy implementation of the interface. As you go along and learn more about the problem and other components that interface with this component knows what they need from yours becomes clear, your mock implementation becomes your component interface and you can now get down to the nitty gritty.

Note: You can start with the nitty gritty earlier as well (just to get a feel for transactional attributes and persistent framework) but without publishing the interfaces to other components. They will use your mock implementation for now until it becomes clear what those components need from yours.

Implementation details: Since it is a wise thing to EncapsulateDesignDecisions? you will probably use FactoryMethod to return the MockImplementation? as an interface but you could as well return the simple mock implementation as such.


And at first read I tought the "MockImplementation?" in MockImplementationBecomesComponentInterface referred to an actual MockObject, which got reused as ComponentInterface?. But maybe this could really be done.
EditText of this page (last edited October 17, 2005)
FindPage by browsing or searching

This page mirrored in ComponentDesignPatterns as of April 29, 2006