Recommended Approach?

Topics: CAB & Smart Client Software Factory
Oct 6, 2005 at 9:42 AM
originally posted by: RTA_SPUD

I am grappling with whether I use the Controller to explicitly call the service Business Layer or to have the WorkItem. Or, both.

Is there a recommended way to accomplish this UI --> Business Layer/Service. Being new to the CAB I'm trying to follow a "Best practice" approach. I would prefer to use a common way -- not spread functionality across boundaries.

Thanks,
Oct 6, 2005 at 10:06 AM
originally posted by: DLorenz

I am wondering the same thing. If we compare CAB with the MVC approach, the SmartPart is the View. The Model is the state in the WorkItem. However, the Controller could be a combination of CAB Controller and WorkItem since the CAB Controller is the logical place to deal with data coming from the SmartPart. However, the WorkItem is what drives the usecase and creates more workitems, acting like a controller by showing more smart parts. Also, its just as easy to send the SmartPart Data from the controller into the WorkItem, but then why do we even need a CAB Controller in the first place.
Oct 6, 2005 at 11:15 AM
originally posted by: RTA_SPUD

Yes. If you look at the examples there is work in the controller and in the workitem. The graphic however shows the controller --> workitem --> service.

I'm old school where I'm strict layered architecture -- not promoting it, or saying it is better -- so my view is I need to only know as little as possible to do my work and no more. Any more, and I'm a maladroit.

Right now we are looking at the WorkItem getting information from the Controller. And the WorkItem going to the service. However, I'm open and would like any constructive feedback. I'm still a newbie to the CAB so I may not know all the nuances on the road travelled.

thanks,
Oct 11, 2005 at 7:23 AM
originally posted by: RTA_SPUD

See the CAB Walkthrough Guide under the Help directory October 2005, Code Drop
Oct 26, 2005 at 1:19 AM
originally posted by: CharlesGamble

I am of the opinion that it is probably better to have the controller accessing the service rather than the workitem.
This is because you can re-use the view and controller more easily in another work item as it does not rely on the workitem getting it's data.

Any other views are welcome..
Charles.
Oct 26, 2005 at 4:04 AM
originally posted by: DLorenz

It's probablay just preference at this point.
Oct 26, 2005 at 4:31 AM
originally posted by: BradWilsonMSFT

In general, I agree: the less you know about your intended runtime environment, the better; I would, therefore, prefer the controller to talk to the service directly as a result of dependency injection instead of presuming that it is contained in a particular type of work item.