Saturday, March 04, 2006

Shoddy Typing needs more typing

What Bruce's book did make me realize was that although I agree on having some typing eliminated, his arguments against strong typechecking are not that sound. Actually, we get the impression that he sees it as a nuisance causing clerical work; that is not a very good argument against it. If you look at what Rexx does, it gives you a type that can be String and numeric and treats it the same way; now if you go and do impossible things, you'll be flagged at runtime. NetRexx also has almost the same approach, but it also blends in with Java's type system,  so there is actually a wide choice for the programmer to choose from. I have the distinct impression that strong typing is an asset and not a liability; *when your model is sound* strong typing (and we even type our yes/no binary schemes to a more specific type than boolean) only helps you to avoid errors. When dealing with metadata in your application, like model- and meta model data, it is essential in avoiding layering errors that are too easy to commit without strong typing. Where he does hit the hammer more or less on the nail is in the difficulty of having generic algorithms when strongly typing, but this also can hint to a too procedural approach, in which parts of the algorithm are not well hidden in the objects. This is called polymorphic; I am sure that Bruce knows.

No comments: