Tuesday, July 17

Flame on!

One of the many mailing lists I'm on is the Test-Driven Development (TDD) list. This list has some big name subscribers, including Ron Jeffries, author, practitioner, well known for Agile/XP.

Someone posed a question of the list regarding the use of Generics, and how well a generic collection conveys intent, versus deriving a non-generic collection to handle the object type in question. In this discussion, the original poster (OP) mentioned he's enumerating the collection -- because it's "prettier" than iterating it. Reading through this on Sunday morning, I replied, letting the OP know that if the List is of any real length, you're better off iterating it -- you get a 5%+ performance gain over enumeration.

Ron Jeffries and 2 other list-subscribers then jump in, demanding "proof," "test results," questioning my programming capabilities, questioning my use of various techniques, telling me that the "bozo bit ought to be flipped" because apparently my argument didn't make sense to at least one of these guys.

Hey guys -- hello -- not here to have a fight. Not here to win a debate, not here to prove a point -- I was simply offering a bit of advice gleaned from my own .NET experience.

The list erupted in idiocy and assclownery. I ignored it for almost two days -- a tactic that proved surprisingly effective, as a couple people backed up my original position. I stopped back in this morning to point out that enumeration produces 120% as much IL as iteration, including a try/finally block. Granted length of IL alone isn't guaranteed to be a performance indicator, different operations may have different costs, but it's a pretty good indicator.

All that said -- my respect for Ron Jeffries has evaporated. At one point in the thread, he made the comment, (paraphrasing) "I can write a collection that takes longer to iterate than enumerate." Hey Ron, that's fantastic buddy -- anyone with half a clue can write something that performs poorly, on purpose. The point of the matter however was generic Lists, not some RonJeffriesSpecialObjectCollection.

I have crossed Ron's name off my copy of the Agile Manfifesto in thick, black marker.

No comments: