Dot Net

Syrinx .NET Development Blog
Need help on your project? info@syrinx.com, or toll free (888) 579-7469, press 1

CAB - Composite Application Block

   I recently had a chance to work on a project for a client using CAB, which stands for Microsoft’s Composite Application Block. The framework offers quite a few nice features that help with creating applications that are complex and big. But the biggest culprit that I see with it is that it may be a little on the high learning curve side. Once you get your hands on the included samples and start coding it things will get better and start ticking.

  
CAB introduces the workitem, smartpart and workspace classes, these are classes that are mainly used for UI management. SmartParts are just your view/userontrol wrapped in a fancy CAB terminology. However the CAB framework encourages the use of the MVP pattern (Model View Presenter). Which I think is a plus, since it makes unit testing easier in addition to the better code abstraction that it provides. Btw, I do not think MVP is a fancy name for code behind as some others might think it is, but that is something I want to talk about at another time. Next is the workspace, which is a usercontrol that is used as a placeholder within the form, so that we can put smartparts in it. Workspaces provide functionality to interchange smartparts, provide them in a tabbed style or dock them in a certain fashion. Then we have the workitem, its main responsibility is to manage a use case which is an important concept in CAB. In CAB business requirements are broken down into use cases which are implemented as workitems.  In addition, it is also responsible for the creation and management of smartparts which are used to carry out the use case requirements.

  
Another important CAB concept is the event broker, the event broker allows objects such as the workitem and smartpart to communicate without any direct references. As a result assemblies will not have referential constraints like other some other designs. Which can ease development efforts since we can have multiple teams working on different sections (use cases) of the application. There are a few other CAB features that I did not get a chance to fully utilize since the project that I worked on did not require it, such as the state injection and command features. For more info on CAB I suggest visiting the CAB website on CodePlex at http://www.codeplex.com/smartclient, it contains a forum with a good community of  developers sharing there knowledge and experience on this wonderful framework.

GaryY

Comments

No Comments