Blogs

Three reprints from when COM ruled the land

I’ve just finished posting three reprints from back in 1998 and 2002 when I was working on lots of COM stuff. Sinking connection points in C++ objects - shows you how to use the least COM possible to connect to Connection Points and provides a C++ template that does all of the hard work for you. Designing asynchonous COM components for VB - This example COM component provides three COM objects for using the Win32 Mailslot IPC mechanism.

Cool

Sometimes I think programmers find the wrong things “cool”… This cartoon kinda sums it up ;)

Restricting the use of extension methods?

Having looked through the slides that Vagn pointed me to in a comment to my recent post about C# v3.0 Extension Methods I can understand, a little more, about the reasoning behind the change to the language. Given that the C# v3.0 spec contains the following warning: “Extension methods are less discoverable and more limited in functionality than instance methods. For those reasons, it is recommended that extension methods be used sparingly and only in situations where instance methods are not feasible or possible.

Concepts and C++ Templates

The slides from Herb Sutter’s C++ Futures talk (TLN309) at this year’s PDC refer to “Concepts” in C++ templates; for me this is a much more useful addition than the auto keyword repurposing. I’m sure this is something that would make Chris Baus happy… I did a little Googling and came up with this paper which describes the proposal in detail. It looks pretty good. In summary a concept that is required by a template can be defined in code and the compiler can check that the type supplied to the template adheres to the concept and should be able to produce more useful error messages when it doesn’t.

Whilst I'm on the subject of code communication

I’ve never really got to grips with the STL’s algorithms; actually that’s not strictly true, it’s really just for_each() that I have most problem with. To me, code that uses for_each() simply doesn’t communicate as clearly as code that uses an old fashioned loop. What brought this to mind originally was Ben’s post on Code Circle about custom binders for member functions… This code just doesn’t do it for me:

Sacrificing precision for ease of use?

I’m probably jumping the gun a little here as I can’t find Herb Sutter’s slides that Matt Pietrek is referring to, but… Once again I find myself asking why is it actually useful to repurpose the auto keyword in C++… The idea seems to be that rather than this: foo::iterator<int> i = myList.begin();</int> You can do this: // Type of 'i is inferred from the assignment auto i = myList.begin(); I really don’t get what’s with these “productivity” enhancements that allow people to think less whilst coding.

Thoughts on testing COM objects

Ben over at Code Circle is thinking about unit testing COM objects. I did quite a lot of this back in 2000 when I was working with an investment bank. The first thing you need to realise is that COM is just an interface layer; so lots of your unit testing should be done on the code that the COM interface layer calls into. You can test pretty much all of the actual functionality of a COM object without bringing COM into the mix at all.

C# v3 Extension methods, syntactic sugar for the lack of free functions?

There’s a lot of noise coming out of the Microsoft PDC right now. Something that interested me was the future direction of C#; you can grab the spec from here. It seems they’re adding “extension methods” which, to me, appear to be just syntactic sugar to make up for the lack of free functions… In C++ you can have functions that aren’t part of an object. In C no functions are part of an object.

Overriding virtual functions, C# is better than C++

I’ve been merging my UDP framework development branch back to main, building all of my example servers and running all of the “black box” server tests for The Server Framework. In doing so I’ve experienced the pain of changing virtual function signatures. This is one area where C# syntax is definitely better than the C++ syntax… The Server Framework relies on derivation for extension and use. That wasn’t one of my brightest ideas.

Rootkits

Just saw a mini review of Rootkits: Subverting the Windows Kernel over on Ted Neward’s blog. Looks like the perfect follow up to Undocumented Windows 2000 Secrets as I continue my slow progress towards being able to write Windows device drivers… From the sound of Ted’s review it’s written in a similar way to the Undocumented secrets book; showing you how to write drivers which aren’t for real hardware… Anyway, I popped over to Amazon and it was being recommended on the front page for me due to my past purchases.