Enhancing Microsoft’s COM Components

As we saw in the Ad Rotator example, VBScript classes can be used to enhance existing COM components. Rarely will you find an existing COM component that meets every single one of your requirements for a given project. Rather than scrapping the notion of using the existing COM component, though, why not use it as a foundation and use VBScript classes to include the needed extra functionality?

This is exactly what was done in this chapter with the Ad Rotator. A random banner rotation application with impression and click-through tracking was needed. Ad Rotator met some of those requirements, but not all. Rather than dismissing Ad Rotator altogether, we embraced the random banner display and click-through tracking capabilities of Ad Rotator and wrote our own VBScript wrapper class to add the impression tracking. Existing COM components are great building blocks, and in my opinion, should be used as often as possible.

Using existing COM components is a lot like buying an existing house and applying your own add-ons, as opposed to building your own made-to-order home. For example, if you wanted a home with a deck and the only homes on the market were those without decks, you would have two options:

  • Buy an existing home and add on a deck.

  • Build a new home from scratch with, of course, a deck.

Buying an existing home and adding a new deck requires less time, effort, and money than building a new home from scratch does. Similarly, using existing COM components ...

Get Designing Active Server Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.