Hacker News new | ask | show | jobs
by jodrellblank 1086 days ago
> "I subscribed to 'Object' magazine, and still recall one article breathlessly predicting that in the future bespoke development would become bunk as folks would just buy e.g. an Aircraft object off the peg and plug it into their application. "

One drum I keep beating is that COM in Windows is amazing for scripting and interoperability between programs. Before PowerShell and "everything is an object [but you're stuck in one .NET process]" there was COM. From Python, from VBScript, from ActivePerl, even in Powershell to break out of .NET, from C# and Java, you could do their language equivalent of:

    $snmp = new-object -ComObject olePrn.OleSNMP
    $snmp.open('127.0.0.1', 'snmp_community', 2, 1000)
    $snmp.get('.1.3.6.1.2.1.1.3.0')
and voila, pluggable SNMP engine into any script in any Windows scripting or programming language. Use it in Excel in Visual Basic for Applications and update your spreadsheet with SNMP results. Then embed the Excel spreadsheet in a Word document. Ppen PowerShell on Windows and run this code[1] to query all registered ones, 1744 on my system, surely some are useful or fun?

Want to read JPG headers? Lean on Explorer to do it, without needing a JPG metadata library in every language. Want to integrate with Windows Text to Speech, or Excel, or Dyalog APL or send a fax from JScript or automate a browser or whatever? COM objects are there.

And it's a world being thrown away in favour of "simply download a Selenium wrapper for every language" and "simply do an OAUTH login to a web service to interface with a styled sluggish CRUD text system". And that's a shame, because web developers, macOS users, Linux users, smartphone users, don't know what they're missing. I'm sympathetic to it being apparently horrible to program the backend in C++, but this world you're scoffing at actually existed and has good features especially for the casual hacker who wants to use system-wide standard interfaces to large and powerful engines, with client and server written in differing languages.

[1] https://stackoverflow.com/questions/660319/where-can-i-find-...

5 comments

On the other hand, programing those dynamic dispatch COM interfaces was really not so fun. There must have been 20-30 interfaces that all implemented IUnknown, but there's only one REAL IUnknown.
On macOS you can take advantage of Objective-C runtime or XPC.

On mobile OS, entitlements or OS IPC like Binder.

In what concerns Windows it is still pretty much present tense, how COM is spread all around the OS, specially since Vista.

>don't know what they're missing

Maybe you don't kow what you are missing by just using pipes with small binaries for everything :)

Take the video player MPV, it can be controlled by sending commands into a named pipe, which is good, so you can control it from a Python script - but now instead of having a system-wide standard like COM where you have PyWIN32 which works with any COM object to any COM program and you call methods from the MPV documentation with Python numbers and strings, now you have to have a Python-to-MPV-JSON-Schema serializer in your code, and if you want to use C# you need a C#-to-MPV-JSON-Schema-serializer in your code. All you're really doing is triggering some code inside MPV - calling some library functions - but instead of a convenient system-wide standard way to do it, there's a different inconvenient non-standard way of doing it from every language to every program. Strictly worse.
COM was awesome tech! I wish we had an equivalent today.

I did a ton of python-com projects for a big aerospace company in the late 90's and it was amazingly easy to get a lot of well-integrated functionality for little time and effort. Really sad that it's not more common now.

COM is the main Windows API since Longhorn ideas were redone as COM.

It isn't going anywhere, even if the tooling keeps as clunky as ever.

Sorry, I wasn't clear in that post -- I'm on Linux, and I wish Linux had an equivalent tech.
not exactly same, but dbus
If I could upvote you 100 times at the expense of not being able to vote for the rest of the year, I would do it right now.