5 ms·
Not a lot of software really feels like "magic" to me anymore, which is unfortunate, but system programming on Windows often still feels like some arcane art.
by non-entity 6y ago
Not a lot of software really feels like "magic" to me anymore, which is unfortunate, but system programming on Windows often still feels like some arcane art.
- classified 6y agoBecause it is. MS's developer tools have gotten quite nice but the OS itself is a sprawling mess.
- projektfu 6y agoThe examples in the docs were also usually the bare minimum to show that the function existed, and usually full of memory leaks and bad behavior. Guessing what errors might arise was always fun. And then, the OS started inserting proxies on your interfaces whenever it wanted without telling you it might happen. Fun times all around. Favorite “COM-ism”: IClassFactory, the basic interface to a class. Why not call it IClass? Or IFactory since a class is essentially a Factory pattern? IClassFactory makes it sound like a Factory for Classes, not objects.
- commandlinefan 6y ago> full of memory leaks With an interface like AddRef/Release, they all but guarantee memory leaks.
- pjmlp 6y agoIf using bare bones C, yes definitely. Developers that know what they are doing would use a C++ library with support for COM smart pointers, .NET or Delphi.
- recursive 6y agoUsing COM from .net absolutely does not prevent leaks. I still don't really understand COM to this day, but I vividly recall spending significant effort and ultimately failing to do Office interop without leaking.
- asveikau 6y agoMy experience using COM with .net is that the GC does not get the hint that there is significant memory that will be released when it drops the COM wrapper object, so a "big" COM object or even many ones will not make the runtime start a collection and it ends up as a leak even though kicking the GC would probably do the right thing. So I would end up wrapping the objects in IDisposable and calling Marshal.ReleaseComObject on Dispose. Then COM objects were usually wrapped in using() to remain idiomatic for manual cleanup in c#. That was some years ago.
- asveikau 6y agoIf you put it in a C++ smart pointer it winds up pretty similar to ARC. (Yes, I have heard the compiler person's explanation that an ARC-type solution can generate fewer reference count modifications than a c++ smart pointer.)
- parasight 6y agoI was a junior back then but COM felt like magic to me. I think MS made COM more arcane than necessary. It was not until I read the book Essential COM by Don Box that I understood COM.
- PaulHoule 6y ago"Essential COM" is one of the top computer books ever written and I'd recommend it to anyone who is interested in object systems even if they don't code for Windows. (e.g. I think better than "The Art of the MetaObject Protocol")
- teh_klev 6y agoI have my copy from before the days when they tarted it up to add to the Developmentor series. I kinda miss Don Box doing his thing, quite an entertaining showman (who remembers Box sitting in a bath on stage talking about SOAP?) and tremendous technical writer.