Depending on the system design, the Prototypical Object Factory design pattern can be implemented as an ActiveX EXE project, as I suggested in the "Scenario" section, or as an ActiveX DLL, as I alluded to in the third point of the "Ramifications" section.
Implementing the Prototypical Object Factory design pattern in an ActiveX EXE should be carried out as follows:
There are two rather important points to keep in mind when implementing the Prototypical Object Factory design pattern in an ActiveX EXE. First, if zero downtime tolerance is in place, subsequent requirements to create new ClassModules should be defined in new ActiveX EXE component projects, as illustrated in Figure 9-1. Second, the object factory must be implemented as a Singleton design pattern (Chapter 10) to ensure that all objects are registered with the same object factory.
Frameworks in many cases are implemented as DLLs that are loaded into a client process. The client typically extends the functionality of the framework by either inheriting framework interfaces or by trapping framework events. By implementing the Prototypical Object Factory design pattern, the framework can permit the dynamic extension of framework behavior.
Let's assume the client was developed as a Visual Basic Standard EXE project. In the References dialog box, you select the appropriate framework ActiveX DLL. This will give the client access to all the framework's interfaces, classes, enumerated data types, and user-defined types, which you can easily navigate through using the Object Browser in the Visual Basic development environment. In the client code you could then do the following:
When operations are invoked in the framework that require the functionality defined in the Prototype interface, the behavior you defined in your ClassModules will be available.