.NET Framework and COM
I was speaking to someone the other day who asked me if I developed in Java. When I said my skills were in the .NET Framework technologies he said that these were the devil incarnate. I don't want to open age-old debates but he said one thing that I had not heard said before开发者_开发技巧 and wondered if anyone could shed some light.
He said that the .NET Framework was built on top of COM. Is this true? Could someone expand please?
Parts of the framework on Windows were implemented on top of com (that is, the implementation used COM objects) - this has become less and less true in every coming version of .NET.
If, however, you are talking about the compiler and the runtime (rather than the .NET libraries and code written in .NET languages), I believe these were written in c++ and do probably use COM (again, on Windows).
There are alternate implementations of .NET, most notably Mono, which runs on Linux/Mac/Andriod and Windows. Since most of these platforms do not have COM, as you can see, .NET doesn't have to use COM at all.
It's just how some of the MS .NET framework has been implemented.
He is wrong.
However, .Net can interoperate with COM.
This is not true and there is nothing to expand on. The .net framework can interop with COM, but that's it. Your friend should stick to Java!
Does it matter? Yes, most of the Windows API (except the win32/64 API) is COM. This includes most controls .NET wraps for you in a nice managed package and all of the DirectX interface (which WPF uses extensively).
So what?
It's true that .Net was initially built on top of COM. In fact many of the API calls in the framework can be directly traced to calls to COM objects or to the win32 API layer. It's important to realize this is just an implementation detail. Check out mono, the open source version of .Net. It is clearly not built on top of COM, and it is considered to be a wonderful platform for writing Android, Mac, Iphone, and Linux applications.
Remember that in a religious war there are no winners.
I suppose it depends on what he meant by "build on top of COM". In the sense that the framework provides a built-in bridge to host and call COM objects, as well as multiple COM interfaces as part of the runtime itself, yes. In the sense that every .NET object is a COM interface, certainly not; I imagine the VM itself is not built on top of COM either.
When push comes to shove the answer is, "it doesn't matter" - if the framework fits your needs, performance is adequate and you're pleased with the libraries and development tools, what it's built on should only matter if it's broken or when you're messing with internals, both of which (I imagine) are not the case.
No, it's not. You can interop with it and access programs such as Excel and Outlook, but it's not built on it. Your friend is going to be in for a bit of a rude awakening when he goes to the business world and realizes a lot of it is .NET (although a large portion of course is Java and native languages as well).
That's a very simplistic view.
For technical details, the dup question cited by @SLaks in comments says it all.
At heart, .Net was intended to make solving complex technical problems on Windows (the whole OS, not just the COM and DCOM parts) a lot easier - goals were speed of development and simplicity of code. Just like Java was intended to do for cross-platform development.
If you look at the recent development track of C# (the most common .Net language) vs Java, it's increasingly hard to argue that Java is way ahead as a programming language, though for sure it once was. I am always suspicious of such zealotry on either side of the fence. Ignorance breeds contempt.
Not true. .NET is capable of interacting with COM libraries but does not depend on them much less being based entirely upon them.
Besides, anyone who feels that strongly about anything is to be regarded with some suspicion. i.e. his/her opinion should be taken with a grain of salt.
Another besides... What's did your colleague have against COM? Sure, there are better way to do things now but COM was a great idea in its time and one that will stick around for years to come.
精彩评论