Component Object model

Wednesday, 14 September 2016

Component Object model


Overview 

Component based model developed by Microsoft to introduce the language interoperability. To know about COM we first know the scenario when COM concept comes in the .Net. We know that in object orientation concept was  re usability of  the code within the same application, but in any case if i want to call the function of any class from other application of different language then it was not possible.
Another disadvantage of object orientation is that after development of the software any change is required on any classes then the whole application needed to be rebuilt and deploy again to the client machine. Actually the problem is that in this case we are getting the reusability for a particular application not for whole application level.

What is COM?

COM is about clients communicating with objects. COM provide the below facility in application level

Language Interoperability: If we look forward in object orientation concept then class of one language cant not use in another application of other language. Microsoft to introduce the language interoperability’s with component Object model.

Location Transparency: We can deploy the application in anywhere of our machine and use it from any other application of our machine. If any modification required in the component we will only upgrade the COM component and corresponding changes automatically reflect those application where this component has used.

Object Oriented Programming = Polymorphism + (Some) Late Binding + (Some) Encapsulation + Inheritance
Component Oriented Programming = Polymorphism + (Really) Late Binding + (Real, Enforced) Encapsulation + Interface Inheritance + Binary Reuse”


Note: If you are developing your client .NET application on the same machine, you don't need to manually register it. However, if you are working entirely on a new machine, you need to register this component with the regsvr32.exe utility. To register a COM component you have to write the following code regsvr32 "Path where COM DLL placed" Now any modification or up gradation done with the COM component then just build the application and replace the component to the register component path.