Use classes all the time

If you picture yourself creating your entire program out of these classes, the interaction of each part with the others becomes tightly controlled and the extensibility of the entire program is enhanced. Your program becomes far better structured and designed. In short, you have better-quality code.

How do you and your Visual Basic development group progress toward creating programs full of classes? The question, “What should be in my classes?” is a frequent one, and there is no simple catchall answer. In the textbooks, the examples are often too “real-world.” Classes such as Flea or Tyrannosaurus make good examples to demonstrate concepts in the manuals because they directly map to real-world objects. Unfortunately, most of my programs seem to be concerned with more mundane problem areas—usually it involves taking some data from one place and putting it somewhere else. Does this mean that the problem is not suitable for an object-oriented approach? Not at all!

To discipline myself to use classes in these situations, I adopt the following rule: Do not declare any user-defined types. Wherever you have a user-defined type, replace it with a class.