Chapter 2. Interface-Based Programming

In this chapter, you will learn the basics of interface-based programming. Although this may seem like review to some Visual Basic developers, the truth is that—from my experience teaching at various companies—very few developers understand how interfaces work in Visual Basic, and those who do, do not employ interface programming in their projects.

Interfaces are the primary building blocks of COM+. What’s more, even if it may have been possible to avoid interface-based programming with Visual Basic altogether in previous versions of COM and Windows, this is no longer possible with COM+ and Windows 2000. To take advantage of the new features of COM+, you must understand interface-based programming and write your code in such a way that it utilizes interfaces as much as possible. Interface-based programming is not only necessary to take advantage of new features in COM+, but it also provides us with a mechanism for upgrading our components. Furthermore, interface-based programming makes it possible for us to use a feature in object-oriented programming known as polymorphism. Polymorphism is a loaded term in the object-oriented world. One definition is that multiple classes may have the same method with the same signature (input and output parameters) but have slightly different semantics. For example, classes like CChecking and CSavings may each have a MakeDeposit method, and even though the overall intent of the methods may be the same (to add ...

Get COM+ Programming with Visual Basic now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.