Does an Object Need Type Information?

Short answer: maybe, maybe not.

Long answer: whether or not an object or component requires type information depends on how it expects clients to use the information. In cases such as objects that support OLE Automation or the OLE Controls specification, the client will expect type information to be available. In fact, these are the only two documented and required uses for type information at the time of writing. However, many possibilities for additional uses outside of standard Automation or Controls scenarios have yet to be articulated. Said another way, in some cases aspects of Automation—that is, the IDispatch interface and the idea of late binding to methods and properties through a dispatch identifier—are useful in and of themselves without being oriented toward end- user, cross-application macro programming. In certain cases, event sets, which involve the use of the Connectable Objects technology, are useful without an OLE control lying around. It's just that today we lack development tools or other sorts of generic clients for these objects that will take advantage of such features and the mere presence of type information, regardless of whatever else the object happens to do.

As I pointed out in this book's introduction, there is an interdependent relationship between the tools available to work with objects and the general expectations of what those objects provide. An increase on one side usually leads to an increase of features on the other. No tools that really exploit type information will appear until there are sufficient objects that provide it, but objects may not provide it until there are sufficient tools to exploit it. I'm saying that you should consider the future of the components (or tools) that you put together because providing (or browsing or exploiting) type information now, which isn't very difficult to do, empowers future clients or components to achieve a higher level of integration than is available today.

It's really your choice: do you want to meet minimum requirements today or set yourself up for new possibilities in the future? Your own development cycle may ultimately determine this. You simply need to understand that although you hardly ever have to provide type information, it will become more and more useful to do so. It's worth a little time now to understand what it is and how it's used, because it will come up in other chapters of this book. And who knows? You may find a new and innovative use for this stuff and open up a new branch of the industry.

Maybe, maybe not.1

1 My lunchtime reading of Robert Fulghum's book with this title has I believe influenced my writing here (maybe).