Lesson 1
Component Object Model Basics
A software component is a modular, reusable, and self-contained unit of software that encapsulates a specific functionality or set of functionalities. It is designed to interact with other components, often in a larger system or application, through well-defined interfaces. The key characteristics of a software component include:
- Encapsulation:
- A software component encapsulates its internal implementation details, exposing only what is necessary through its interface(s). This means the internal workings of the component are hidden, and only the functionality defined by its interface is accessible to other components or applications.
- Reusability:
- Components are designed to be reused across different applications or systems. Because they are self-contained and interact through standardized interfaces, they can be plugged into different environments with minimal modification.
- Interoperability:
- Software components can interact with other components or systems, often regardless of the programming languages or platforms used. This is achieved through well-defined interfaces and standards, such as COM (Component Object Model) in Windows, which allows components written in different languages to work together.
- Modularity:
- Components represent a modular approach to software development. Each component typically implements a specific piece of functionality, making it easier to develop, test, maintain, and replace individual parts of a system without affecting the whole.
- Interfaces:
- A software component exposes one or more interfaces that define the methods and properties that other components or applications can use to interact with it. These interfaces serve as a contract that the component adheres to, ensuring consistent behavior.
- Independent Deployment:
- Components are often designed to be deployed independently. This means they can be developed, tested, and updated separately from other components or systems they interact with.
Examples of Software Components
- COM (Component Object Model) Components: These are binary components that can be used across different languages and environments in Windows.
- JavaBeans: Reusable software components that can be manipulated visually in a builder tool in Java.
- .NET Assemblies: Components in the .NET framework that can be shared across multiple applications.
- Web Services: Components that can be accessed over a network via standard protocols like HTTP and SOAP.
In Summary
A software component is a building block of software, designed to be self-contained, reusable, and interoperable. It simplifies software development by promoting modularity and enabling developers to build complex systems from smaller, manageable parts that can work together seamlessly.
Component Software
COM, as its name indicates, is a specification and a set of development paradigms that supports the development of software components.
But what is a software component?
In general, a software component is a module that follows some component specification.
The two most popular component software technologies are COM and JavaBeans. Components normally provide functionality via a set of functions or methods.
Unlike C++ libraries, we do not need the class definition of a component, nor do we need to link to a component.
All we need is a definition of its services and a way to access it.
We integrate with a component at runtime by having a service provider load the component. Once the component is loaded we can access its services. This is called binary-level integration. A common metaphor used by components is to provide properties, methods, and events or exceptions.
Component developers indirectly expose data as properties. Properties are set via "get" and "set" methods. A component is asked to perform an action via a method call.
Events or exceptions are notifications sent from the component to the module using the component.
Application developers can use components to build applications by loading the components,
getting and setting its properties, calling its methods, and fielding events or exceptions from the component.
COM Programming with Microsoft .NET
COM Module Introduction
Getting the most out of this Module
To get the most out of this module, you should be familiar with the following C++ concepts:
- classes and structures,
- constructors,
- inheritance,
- multiple inheritance,
- virtual functions, and
- pure virtual functions.
You do not have to be an expert in these areas.If you need a refresher, check out one of the books recommended on the Resources page.