What is a Software Component?

Team-Fly    

 
.NET and COM Interoperability Handbook, The
By Alan Gordon
Table of Contents
Chapter Two.  Comparing COM and .NET


Before I talk about .NET as an enabling technology for creating and using software components , it makes sense to define what a software component is. A software component is a binary, self-contained, reusable , and language-neutral piece of software that is used as a building block for applications. It's important to understand the distinction between an application and a software component. You can use Microsoft Word as an application to write letters or even a book (in fact, I am doing that right now), but Microsoft Word is also a software component. It has an APIthat is exposed through COMand, through this API, you can use Microsoft Word as a report writer. When you are writing a letter or a book with Word, you are using it as an application. When you use Word as a report writer, you are using it as a software component. The key distinction in the second case is that Word is being used as a building block for another application. I emphasized the word reusable in the definition of software component because it's the motivation for the other elements of the definition. In other words, software components are binary, language-neutral, and self-contained so that they are easy to reuse . With COM, a software component is deployed in an in-process server (a DLL) or an out-of-process server (an executable). With .NET, components are deployed in an assembly, which is just a DLL that contains MSIL code and metadata instead of native x86 code.

COM has only one physical realization of a software component. A software component is a COM class that is implemented in either an in-process or out-of-process server. With .NET, there are two physical realizations of a software component. First, a software component can be an externally accessible type (typically a class) that is deployed in an assembly. This type can then be used as a component by applications or other components on the same machine. The CLR is the integrating substrate that makes this possible. This usage scenario fits the definition that I gave earlier of a software component. The externally accessible types in an assembly are binary, language neutral, and self-contained, but .NET also allows us to expose some of the methods in our types as XML Web services. XML Web services are software components also. They use the Internet as their integration substrate. They also fit the definition that I gave earlier of a software component: They are binary, language neutral, and self-contained.

There are some fundamental differences in how the two types of .NET software components are used and integrated with client applications and other components. For instance, when used on a single machine, a .NET component may have a unique name that is created using a cryptographic key, but this unique name is not required. On the Internet, an XML Web service is identified by its URL. The cryptographic key associated with the component is not exposed in this scenario. Similarly, with life cycle management, a component used on a single machine will use the garbage collection in the CLR to manage its life cycle. However, on the Internet, an XML Web service will typically be stateless, and a new instance will be created to service each method call.


Team-Fly    
Top
 


. Net and COM Interoperability Handbook
The .NET and COM Interoperability Handbook (Integrated .Net)
ISBN: 013046130X
EAN: 2147483647
Year: 2002
Pages: 119
Authors: Alan Gordon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net