Module defines in which workspace to run?

Topics: CAB & Smart Client Software Factory
Oct 6, 2005 at 3:52 AM
originally posted by: TimWorse

I'm currently working my way through the Hands On Lab exercises, and ran into the following thing. In Exercise 2 (Creating a module), a simple module is created. In the GPSModule class, which derives from ModuleInit, the following code appears:

code
GPSWorkItem item = ApplicationHost.DefaultWorkItem.Create<GPSWorkItem>();
item.Run(ApplicationHost.DefaultWorkItem.Workspaces"MainWorkSpace");
/code

What I don't get, is that the module defines in which Workspace it is placed? Isn't this something the shell application should define?
As far as I can see, this way modules aren't reusable. Or am I thinking wrong, and should modules only be made for only one shell application?
Oct 8, 2005 at 5:59 PM
originally posted by: BradWilsonMSFT

There's uses for both directions. Letting the shell tell the WorkItem where to run makes the WorkItem more reusable. On the other hand, some WorkItems may be specifically designed to work in specific scenarios and not intended to be reused.

A reusable architecture can clearly be very useful. With this as a goal, any communication "up" (from WorkItem to WorkItem, or asking for specifically named workspaces) might be considered a bad smell in need of refactoring.