Object-based vs. Object-oriented Approaches

Visual Basic has always been object-based, meaning that we could always use objects in our programs; but the language provided no way to create objects until Visual Basic 4.0.

Perhaps it would be more accurate to say that it has always been component-based, since, until Visual Basic 4.0, we've been unable to use objects per se but rather we've used pre-built binary components.

Originally, these components came in the form of VBX's (Visual Basic Custom Controls), which really set the stage for where we are today. VBX components provided us with pre-built functionality that we could just plug into our programs and start using. They were so useful, in fact, that an entire cottage industry grew up around them - and various development tools have now been enhanced to support their use.

Unfortunately, VBX technology was pretty limiting in a number of ways. VBX controls were difficult to create, and the way they communicated with Visual Basic was strict and somewhat limited. Because of these problems, Microsoft developed a new standard for component development. These new components were called OLE Controls, and are now called ActiveX controls. Either way, they are commonly known as OCX's (OLE Custom Controls).

Visual Basic 4.0 added a number of actual object-oriented abilities to the language, by adding the class module, and allowing us to create objects based on our own classes. Now, with version 5.0, we have even more capabilities with the addition of the Friend and Implements keywords, along with the ability to raise our own events - all of which we'll discuss in detail later in the book.

Visual Basic 4.0 also introduced the ability to create our own components. This has given us the ability to easily package our objects together into reusable binary modules, as we discussed earlier in the chapter.

Most people look at four criteria when deciding if a language is object-oriented. These criteria are abstraction, encapsulation, inheritance and polymorphism. Let's look briefly at each of these from Visual Basic's viewpoint. I don't want to get into too much detail, here, since there are entire books written about this subject alone; but I do want to quickly illustrate where Visual Basic stands.