Geek Speak

Barry's take on Assert

Barry Lapthorn has a response to my Assert is Evil posting where he concludes that assertions aren’t needed if you have tests… He also raises a point that I missed which is that the typical assert on Windows machines causes a dialog box to pop up and stop your program giving you the option of debugging it or ignoring the assert, etc. This kind of response is not especially useful if you’re writing code that doesn’t interact with a user, such as a service, as the code may not be able to show a dialog box …

Good stuff

I use BlogLines to read my RSS subscriptions. It’s pretty good, and now that the performance issues I had initially seem to have gone away, I like it a lot. It’s very handy to be able to read my feeds from anywhere and always have them up to date and synchronised. One of the features I like is the little “keep new” check box that each item has; check it and the item stays unread.

Opera lover

The Opera web browser is now free. It’s worth giving it a try. I downloaded it after Barry sent me a link to the free registration codes that they were giving away a few weeks ago to celebrate their 10th birthday and I’ve been using it as my browser of choice ever since. It seems faster than either IE or Firefox and I just feel more comfortable in it than in Firefox; no idea why.

AdSense preview tool

The Google AdSense Preview Tool does exactly what it says on the tin. So it’s very useful for working out what kind of ads you’d get if you added Google’s AdSense to your pages.

New C# v3 features explained in context

Ted Neward has a very nice piece about the new language features in C# v3 and how they work together to provide something quite powerful. Go read it! Given that implicit typing, object initialisers and extension methods are all designed to allow LINQ to be a be able to generate classes on the fly and extend existing classes I’d still be happier if they could be optionally restricted from use on ’normal’ classes to help prevent the less experienced running amok with these new language features and creating code that has interesting maintenance properties…

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.

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.