VB6 Programmer's Introduction to COM
In this section, I'm going to attempt to define COM in a piece-by-piece fashion. Let's start with the basics and cover what the letters C-O-M stand for.
Components and Objects
Components and objects are key concepts in COM, but like "COM" itself, the words are often misused and can mean different things to different people. This is because the terms are tricky first to define and then to distinguish, and for that reason I intend to leave doing so until a more rigorous discussion in the next chapter. I want to keep this introduction at a higher level, and so I shall begin by explaining some of the concepts of component-oriented design without going too deeply into what actually makes a component.
Traditionally, applications were distributed in single, large executable files, which are now known as monolithic applications. These had many inherent problems, paramount of which was that if one line of code needed to be changed, then the entire application needed to be rebuilt. This made the development and maintenance of such applications problematic at best.
Component-oriented design circumvents these problems by breaking applications down into components that can be distributed in separate binary files - either dynamic-link libraries (DLLs) or executables (EXEs). In this context, components are pre-compiled, interacting pieces of software that can act as 'building blocks' for creating applications. In some ways, these components can be thought of as raw elements: in the same way that chemical elements can be combined in a multitude of ways to create different compounds, components can be combined to create different applications. Although COM is not essential for component-oriented design, it does make the entire process considerably easier to implement.
The idea is that a given component can be re-used in different applications that require similar functionality. So, for example, you could construct an invoicing component for one application that could then be reused in other applications that also require an invoicing tool.
Another advantage of this mode of design is that it allows the individual components of an application to be updated easily. Only one of the comparatively small binary files needs to be replaced, unlike in the old monolithic case where the entire application had to be recompiled in order to reflect changes in the source code.
Page 2 of 12