Thunderclap, the Newsletter of Rolling Thunder Computing

Volume 7, Number 2, Fall 2005

In this issue:

Feature Article: The Composite UI Application Block -- A Prefabricated Toolkit for a Modern Smart Client App

Blatant Self-Promotion: New  in-house class on Composite UI Application Block

A Good Read: Two Books about Funerals by Thomas Lynch 

Annabelle and Lucy's Latest

Subscription Information

 


Feature Article: The Composite UI Application Block -- A Prefabricated Toolkit for a Modern Smart Client App

Microsoft .NET is an advance over its predecessors every way but one. Many of my clients have previously written desktop applications using the Microsoft Foundation Classes (MFC) in C++. They provide the prefabricated skeleton of the types of desktop applications we most needed to write at the time, containing features such as document management, print and print preview capability, and implementations of Object Linking and Embedding and OLE Automation. Using this boilerplate instead of having to roll our own greatly simplified the production of desktop applications, and many developers wonder where it got to in .NET.

We now have new problems to solve on the desktop. As I wrote in my magnum opus Introducing Microsoft .NET, “Spreadsheets and word processors have been pretty much beaten into the ground, but … we’ll be writing more rich front ends for Internet applications.”

Our new rich client applications require different feature sets than the MFC provided. For example, we now care much more about assembling applications by loosely coupling components written by separate development teams, rather than the monolithic .EXE programs built by the MFC. We now care more about persisting state to network data stores and less about OLE. But the one thing that has never changed and never will is that developers want more of their boilerplate prefabricated so they can concentrate on their business logic instead of infrastructure.

To provide exactly that, the Patterns and Practices group at Microsoft has just released the Common User Interface Application Block (CAB). This is a set of classes, built on top of Windows Forms, that provide the prefabricated skeleton of a desktop smart client application.  Originally developed for the customer service application at Dell Computer, it is now available to all .NET developers.

An example of a CAB app is shown in the following diagram. It’s a bank teller application from the Quick Start samples that come with the CAB download.

It’s assembled from several independent parts that are loosely coupled together. The outer frame is known as the shell. The shell developer provides a number of workspaces, windows which can hold separate, independent user interface component known as Smart Parts. In the screen shot above, each tab represents a workspace holding a Smart Part. The customer list on the left and the customer data in the top right are also Smart Parts. At startup time, the shell loads the Smart Parts specified in the configuration file for the particular logged-in user. When the user selects a customer in the left-hand list, it notifies whichever Smart Part is active of the selection.  Each part can then do its own independent thing, such as displaying the details of the customer (above) or showing a map of the customer’s location (below)

The shell and its Smart Parts are generally developed in separate independent plug-in modules. Each addresses a particular portion of the business process, and can be developed by different teams. For example, the Summary tab can be developed by the database team, while the Customer Map tab would probably be developed by a different team, one that knew about mapping. The shell developer is responsible for assembling the parts and writing the code that glues them together.

CAB contains the prefabricated pieces to make this architecture work. For example, it contains the event service that lets the parts publish and subscribe to the events that signal data from one parts to another. It contains the user interface negotiation code that allows selected parts to modify the user interface, for example, adding menu items when they are selected, in a manner reminiscent of in-place activation in user interface negotiation. It contains a persistence service for going into and out of databases in a consistent way, and an encryption service for encrypting data that you send over the network. And it’s completely extensible, so you can write your own provider when you need to plug it into existing business logic.

As an example of some of the prefabricated code that CAB contains, I'll show you an example of user interface negotiation. In a manner somewhat reminiscent of in-place activation in OLE, CAB provides for independent SmartParts and WorkItems to place their items on the shell application's main user interface, the main menu, toolbar, and status bar. The shell programmer provides UIExtensionSites specifying where subordinate items may add their own entries. The items themselves, on activation, query the shell for these sites and then use them to place their own items onto the main user interface. An example of an extended, shared user interface is shown in the screen shot below. All user interface items are owned by the shell unless otherwise called out in the diagram:

The shell created the main menu and allowed a WorkItem (not shown) to insert a popup in the middle. It created a toolbar containing the "S" button and allowed the WorkItem to add the "W" button. It created the ToolStripPanel below the main toolbar and allowed the WorkItem to add an entire floating ToolStrip to it. It created the status bar at the bottom of the application and allowed the WorkItem to add its own panel to it. The shell also shares toolStripStatusLabel1's text with the WorkItem. This sample program is one of the ones I use in teaching my class on CAB, as you see below in this newsletter.

The CAB code resides in a set of source code files that you compile with your project, generally building it into an assembly which you distribute with your smart client application. It’s compatible with Click-Once deployment. CAB is available in both VB and C# versions. There isn’t yet a Microsoft-signed DLL to put into the GAC; you have to sign it yourself if you want that. It requires VS 2005, and is not supported on earlier platforms. Back-porting would be a pain, as it makes extensive use of 2.0 features such as generics.

The main drawback to the CAB is that it’s very new: version 1 in C# was released on November 14 and VB on November 24.  The code seems to work and I haven’t found any bugs yet, but it hasn’t been wrung out the way it will be in a few years. Also, since it’s new, the tool set for it is somewhat sparse. For example, there’s no VS 2005 project template to generate a CAB project. So I wrote a couple of them, one for the shell and one for a module containing a Smart Part, as you can see in the figure below:

You can download them for your own use from here and here. Don't unpack the .ZIP files. Simply copy each of them into your Visual Studio 2005\Templates\ProjectTemplates\Visual C# directory folder and they’ll appear in your New Project dialog box.

 The CAB looks quite interesting, and I forecast a fine future for it. Its online home page is at this link. If you’d like to learn more, I can come to your company to teach it. Click here to read more out about in-house classes.

In the meantime, give me a call if I can help you out with anything. Until next time,  as Red Green  would say, "Keep your stick on the ice."


A Good Read

Two excellent books by Thomas Lynch made me want to revive this section of my newsletter . A funeral director in Michigan and a published poet, he's written excellent collections of prose essays in  The Undertaking: Life Studies from the Dismal Trade and its sequel Bodies in Motion and at Rest: On Metaphor and Mortality. Don't let the use of the word "metaphor" scare you.  He has beautiful writing, excellent insight, and a dry humor that I love. His writing web site, containing a number of his articles not available elsewhere, is www.thomaslynch.com. His funeral directing web site is  www.lynchfuneraldirectors.com.

Here's his take on caskets from the former book, stripping that mysterious object to its bare essence in a way that computer geeks would do well to emulate when designing their programs.  The Jessica to whom he refers is Jessica Mitford, author of The American Way of Death, the 1963 expose that rattled the funeral industry industry and led to its federal regulation, among other changes. The News Hound is a local TV reporter, whom Lynch describes as "apparently untutored in the economic intrigues of wholesale and retail." The Hound's diligent and painstaking efforts uncovered and trumpeted the earth-shaking fact that "I should probably fess up that we buy these caskets for less than we sell them for." So why does almost everyone buy one?

If worth can be measured by what they do, it might help to figure out what caskets "do" in the inanimate object sense of the verb.

How many here are thinking "handles"? When someone dies, we try to get a handle on it. This is because dead folks don't move. I'm not making this part up. Next time someone in your house quits breathing, ask them to get up and answer the phone or maybe get you some ice water or let the cat out. He won't budge. It's because he's dead.

There was a time when it was easier to change caves than to drag the dead guy out. Now it's not so easy. There's the post office, the utilities, the closing costs. Now we have to remove the dead. The sooner the better is the rule of thumb, though it's not the thumb that will make this known.  

...

Another thing you'll see most every casket doing is being horizontal. This is because the folks that make them have taken seriously the demonstrated preference of our species to do it on the level. Oh, sure -- it can be done standing up or in a car or even upside down. But most everyone goes looking for something flat. Probably this can be attributed to gravity or physics or fatigue.

So horizontal things that can be carried -- to these basic properties, we could add a third: it should be sturdy enough for a few hundred pounds. I'm glad that it's not from personal experience that I say that nothing takes the steam out of a good funeral so much as the bottom falling out.

...

In even the best of caskets, it never all fits -- all that we'd like to bury in them: the hurt and forgiveness, the anger and pain, the praise and thanksgiving, the emptiness and exaltations, the untidy feelings when someone dies. So I conduct this business very carefully because, in the years since I've been here, when someone dies, they never call Jessica or the News Hound.

They call me.

Here, from the latter book, is his response to the "pre-need" funeral sales telemarketers that pester you at dinner time. Despised by the public as much as congressmen and lawyers, almost as much as Microsoft, they push their pre-paid funerals with the sales pitch, "You don't want to be a burden to your children, do you?" Here's what Lynch has to say to them. It's not in the telemarketer's script, and usually causes them to hang up. As a father, I agree with every word he says. Think of them when you next play with your kids, or look at the pictures of mine below.

I see them now -- my darling sons, my fierce daughter -- heartsore and vulnerable at the news of my untimely and possibly heroic death. I think of them with their cell phones and gold cards and higher educations and inheritance. And it occurs to me: Why shouldn't I be a burden to my children?

My children have been a burden to me. Lovely burdens every one of them. Taking care of their earaches and heartaches and broken bones and disappointments, paying for their colleges and dance classes and car insurance -- they've been a burden. I think they were supposed to be. Over the years I've had to explain the death of their grandparents, the suicides of classmates, the divorce of their mother and father, the misbehavior of our political leaders, how love hurts and life isn't fair. I've done car pools and bag lunches and overwhelming questions, broken hearts and Little League and PTA, difficult choices and the facts of life. Sometimes it got really heavy. Sometimes I had to tell them "I don't know." 

And bearing these burdens of love and grief has made me feel alive, involved, evolved in ways I never thought I would be; it has made me feel needed and necessary and part of the family. It has made me feel "called" to be a parent. And if it has left me bald and near broke and fairly bewildered, it has likewise left me wondrous, blessed, and thankful. And after everything, being their father has brought more meaning to my life than any other thing I've ever done or been.

And when I die, bearing the burden of burying me or burning me or blasting me into cyberspace should be theirs to do. My funeral will belong to them and they will be paying for it emotionally, financially, actually. Since they have to live with the decisions, why shouldn't they make them? If I've done my job, then they'll know what to do. If the burden of my death, borne honorably, makes them feel as capable as bearing the sweet burden of their births has made me feel, I can do them the favor of leaving well enough alone.

Disclaimer: This section will often refer to commercial  products or services. Rolling Thunder Computing receives no compensation from their vendors in any way, shape, form, or manner; and would decline any if offered.


Blatant Self Promotion: Would you buy a used car from this guy?

 

NEW! 3-day In-House Training Class on Composite UI Application Block

The CAB that I describe above is useful, but has a steeper learning curve than other parts of .NET. My in-house training class on it will get you up and spinning in no time. See the online syllabus here, then call me to schedule yours.

NEW! 2-day In-House Training Class, What's New in Whidbey

This class is for programmers familiar with .NET 1.1 and 1.0. It covers everything that's new in the forthcoming Visual Studio 2005, .NET Framework 2005, and ASP.NET 2005.  As with all Rolling Thunder classes, it can be custom tailored to your needs. See the syllabus online here, then call me to schedule yours.

5-day In-House Training Class on .NET or .NET for Insurance

.NET is here, and it's hot. It changes everything in the software business, and you can't afford to be without it. Rolling Thunder Computing now offers in-house training classes on .NET, using my book as the text.  See the syllabi online here, then call to schedule yours. 

ACORD XML for Insurance In Depth, Including Web Services 

Insurance carriers, learn ACORD XML from David Platt. This 5-day class will give you everything you need to know to jump-start your application development. Learn about security and plug-and-play, and combining ACORD XML with XML Web Services. See the syllabus online here. It can be customized to your needs. 


 Annabelle And Lucy's Latest

And now, the moment for which I know you've all been waiting -- the pictures of my two girls. Annabelle Rose, now 5-1/2,  is considering an early exit from kindergarten for a career in programming, just like her old man. Or maybe she's goofing off with FreeCell, ditto. I haven't introduced her to Spider Solitaire yet. She's now learning to read music and play the glockenspiel in her Kindermusik class. Lucy Katrina, now almost three, likes to pretend that she is a kitten named Wishbone, whom she met in a book called I Like Cats. She is very much looking forward to seeing the trained cats (truth!) at the Moscow Cats Theatre when she visits her grandparents in New York City. She is about to start the ballet class she's wanted for a year and a half, but wasn't old enough for until just now.  She loves to swing on the trapeze on the playset out in the yard. 

   


Subscription Information

Thunderclap is free, and is distributed via e-mail only. We never rent, sell or give away our mailing list, though occasionally we use it for our own promotions. To subscribe, jump to the Rolling Thunder Web site and fill in the subscription form.


Legal Notices

Thunderclap does not accept advertising; nor do we sell, rent, or give away our subscriber list. We will make every effort to keep the names of subscribers private; however, if served with a court order, we will sing like a whole flock of canaries. If this bothers you, don't subscribe.

Source code and binaries supplied via this newsletter are provided "as-is", with no warranty of functionality, reliability or suitability for any purpose.

This newsletter is Copyright © 2005 by Rolling Thunder Computing, Inc., Ipswich MA. It may be freely redistributed provided that it is redistributed in its entirety, and that absolutely no changes are made in any way, including the removal of these legal notices.

Thunderclap is a registered trademark ® of Rolling Thunder Computing, Inc., Ipswich MA. All other trademarks are owned by their respective companies.