June 28, 2005
Generic's aren't harmful - they're just not that sociable

It's no wonder, given the fact that the designers of Java completely botched the implementation of generics, that sentiment along the lines of Generics Considered Harmful begins to appear. But generics aren't harmful. They just need to be done properly, used properly and tooled properly. It is quite possible that no programmer has ever been in a situation that all of these preconditions were met.
The generics in C# and java are just badly done. Pure and simple. Too much work left for the developer, and not nearly enough reliance on the compiler. This takes away the breathtaking flexibility of C++ generics, but still adds the complexity.
That's the "done properly" part. Clearly, even C++ gets it partially wrong, but mostly in ways that you could tool your way out of. As for "used properly" - obviously you can do horrible things with templates. If you use it for it's basic usefulness - which is to provide the equivalent of all the useful helper words and verb and noun modifiers from natural language - then generics work just great. And not having them, leaves you with the alternative of a rich external build environment - you need code generators to not go insane.
Tooling is abysmal in all cases I have seen. The compilers I've used are just to slow. They expose the complexity of template definitions to unwitting template users (a horrible, horrible problem - you should never have to know the insides of a template you use) and fail in other ways to tool templates properly. I've made more comprehensive notes here.

Posted by Claus at June 28, 2005 04:31 PM | TrackBack (0)
Comments (post your own)
Help the campaign to stomp out Warnock's Dilemma. Post a comment.

Email Address:


Type the characters you see in the picture above.

(note to spammers: Comments are audited as well. Your spam will never make it onto my weblog, no need to automate against this form)


Remember info?