Thursday, October 16, 2008

Variant Types Are Bad

I'm busy converting http://www.ozgrid.com/VBA/CurrencyToWords.htm to Java code but having problems since the original coder used variant type e.g. you don't know the type of the variables: MyNumber, DecimalPlace, Count etc looking at the variable declaration but only once you assign a value to it, it also doesn't use type inference (the var keyword in C#) meaning you can assign a string to the variable then later an integer... bad boy! So this makes conversions hard. Not just
that but what about maintenance?! If this code is used in a production environment what about the poor junior that must maintain it a year / decade from now (if VBA code is still running in 2020).

No comments: