Solved

What is COM and DCOM?

Posted on 2000-02-19
4
2,181 Views
Last Modified: 2013-11-25
Can you tell what is COM and DCOM ?
Also, what are their difference?
0
Comment
Question by:cstsang
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
stefanx earned 50 total points
ID: 2537842
COM stands for Component Object Model.
Basically, what this means is that you can write software components that perform a specific job, and then "call" these components from any other programming or scripting language.

Let's take and exaple.
Imagine you keep writing programs that access a database and count how many records are in a specific database table. Each time your write a new program, youcopy and paste your original code. Your boss has just asked you to do this database checking from Microsoft Excel, and you're getting pretty cheesed off having to copy and paste each time.

You could actually rather write a component (in Visual Basic) that does this job. Basically, you may want to tell the component which database to query and you want it to return a long variable that contains the amount of records. Assuming that the component is written and registered in your registry, now all you need to do is allow your program to access this component. In Visual Basic, you do this by going to the Project..Components menu. Add the component in your project, and you can suddenly declare variable instances of the component by saying

Dim X AS New MyComponent.ComponentName
X.DataBase = "c:\My Documents\db1.mdb"
MsgBox "There are " & X.RecordCount & " records."
Set X = Nothing

In Microsoft Excel, you can suddenly use the component in exactly the same manner, while you can also use it from Delphi, C++ or whatever. You can even use it from ASP on your Inter/Intranet Website.

So all in all, writing components makes sense in that you can focus on the job at hand rather than in on all the little common things you need to do. When you debug, you don't have to debug the component each time either, so it makes your life as a programmer easier.

So what is DCOM? DCOM stands for Distributed Component Object Model. What this means is that your program on one machine can "call" a component which actually runs on another machine. Why would you want to do this ?
Well, imagine you write a component that does a really serious job. When you call a method of the component, it takes like 3 hours to run. This is because your boss has given you a 386 with 4MByte of RAM. If you could use his computer (a Pentium 733 with 256M of RAM), it runs in 3 seconds. So it makes sense if you could run the component on his machine, even though you are running the program that needs the component on your machine. This is what DCOM does for you. It will use a network to distribute components across that network. The example may be a bit extreme - a better example is perhaps that you are at home on a modem connection to your work. Your component need to open 1 million records, performs some logic and come back with an answer. Your modem connection is way to slow to try and read 1 million records, but the server at the office is on a fast ethernet connection to the database, so it is easy for that server.
You call the COM component on the office server using DCOM. It does the connection to the database, does the calcs and returns the number to your computer sitting behind the modem.

OK - I hope that helps.




0
 
LVL 7

Expert Comment

by:kamall
ID: 2538941
stefanx,
According to your explaination, I can't see a difference between an ActiveX DLL and a COM object! (I really have no idea about COM objects).
0
 
LVL 7

Author Comment

by:cstsang
ID: 2539347
Can you tell me more detail about these?
Such as which MS product is belong to DCOM and COM
0
 
LVL 8

Expert Comment

by:stefanx
ID: 2539410
Kamall:

An ActiveX DLL (VB Terminology) is a COM object. But there are also COM+ components. I don't know how they differ from COM objects, but you can read more about it at http://www.microsoft.com/com

cstang:

Look at the website named above. Of course, Microsoft has a hell of a lot of products, so I can't just tell you which can work with COM and which can't. But basically, any of the programming languages (VC++, VB and maybe VJ++ (I don't know)) can create COM objects. Any of these can also use COM and DCOM objects. All of the Microsoft Products that contain VBA scripting ability can use COM objects (i.e Microsoft Word, Excel, Access, PowerPoint as well as Active Server Pages, Windows Scripting Control and so on). Microsoft Transactions Server (MTS) acts as a resource controller and COM coordinator.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now