He’s writing a book about Visual Basic. He wants to use a consistent coding style throughout the book and to recommend this style to others without being dogmatic. He’s written code in Basic, FORTRAN, Pascal, C, and C++. He liked them all (except FORTRAN) and wishes he had a language that combined the best of each.
One of his first programs with the old GW-BASIC was an accounting program. After several weeks of work and hundreds of lines of code, the accounts didn’t balance because he had created all the variables with the default Single data
type instead of Integer. In the spirit of Kemeny and Kurtz, he hadn’t known the
difference. He’s been leery of default data types ever since.
He uses Option Explicit religiously and declares every variable with Dim and an explicit data type. He likes variants and uses them for variables that will need a lot of data conversions. But he has a great deal of experience with coding in assembly language, and he hates to write code that is less than optimally efficient, even when he knows the extra efficiency isn’t critical. Therefore, he uses specific simple data types whenever he can.
From Pascal and C programming, Bruce learned the habit of declaring all variables at the top of the block. But when he discovered that C++ allows you to declare variables wherever you first need them, he was an instant convert and adapted his Basic style accordingly. Unlike most Basic coders, he puts Dim
statements next to the first use and when possible initializes the variable on the next line. One of his pet peeves about Basic is that it doesn’t allow him to combine the Dim and the initialization statements, but he fakes it the best he can.
Bruce is tempted by the convenience of type-declaration characters, but he’s decided not to use them because they’re available only for some types but not for others. Besides, they’re ugly. He thinks that the Deftype statement is a ridiculous feature that should be chopped out of the language.