CAB Method vs SCSF Method of using WorkItems

Topics: CAB & Smart Client Software Factory
Aug 11, 2006 at 1:42 AM
originally posted by: pfeds

I have created an application previously using CAB, and we are now designing a larger application based on the SCSF. It seems there is a huge difference in the way modules are structured with SCSF.

With the CAB method (as described in the CAB hands on labs) a WorkItem is in a sense a Use Case. The module contains the ModuleInit class which will add a number of WorkItems that represent Use Cases within that module. I found that to be logical as each WorkItem will handle adding menu items, user controls, and such that the Use Case requires - clean and tidy ;o)

Going by the SCSF labs, a module will have only one WorkItem (ControlledWorkItem), and a number of views that represent use cases. This means that the WorkItemController will handle everything for that module.

I was just curious as to why the two methods are so different. In my previous application I had each WorkItem contain a single view to represent its use case, and the WorkItem could maintain that view and only create it if necessary (if it hadn't previously been created). With the SCSF method I would need to create all views within the module controller which seems to be a bit messy.

I would just like other peoples opinions on what they believe are good and bad points of each method. Thanks.
Aug 11, 2006 at 4:43 AM
originally posted by: samueljmueller

If you look at the bankbranch reference app you will see a class called CustomerWorkItemController. This is essentially a child WorkItemController that handles a specific use case. I have modeled after this in my project, and it has worked out very well.

In my "Child" WorkItemController, I only create one view (AccountView) in the overriden Run method. The AccountView happens to have a workspace, and so in the AccountViewPresenter i load additional subviews into it's workspace (in the OnViewReady method).

In SCSF there is nothing stopping you from creating a WorkItemController for each of your views. Take a look at bank branch and see if their implementation helps shed some light.