Components and objects
Object classes have associated methods that are clearly similar to the methods defined in component interfaces. What, then, is the distinction between components and objects? Components are usually developed using an object-oriented approach but they differ from objects in a number of important ways:
- Components are deployable entities. That is, they are not compiled into an application program but are installed directly on an execution platform. The methods and attributes defined in their interfaces can then be accessed by other components.
- Components do not define types. A class definition defines an abstract data type and objects are instances of that type. A component is an instance, not a template that is used to define an instance.
- Component implementations are opaque. Components are, in principle at least, completely defined by their interface specification. The implementation is hidden from component users. Components are often delivered as binary units so the buyer of the component does not have access to the implementation.
- Components are language-independent. Object classes have to follow the rules of a particular object-oriented programming language and, generally, can only interoperate with other classes in that language. Although components are usually implemented using object-oriented languages, such as Java or C#, you can implement them in non-object-oriented programming languages.
- Components are standardized Unlike object classes that you can implement in any way, components must conform to some component model that constrains their implementation.
The differences between components and objects