Code with Character by TodGolding When I'm writing code, I like my types to be straight shooters. I'm not into types that are complicated or mysterious. It's simply too much work to figure out who they are or what they might expect of me. That's why some of my favorite data types are those that are willing to be direct and honest with me. Take my good buddy, Integer. An Integer data type doesn't pull any punches. He tells you he will hold signed numeric data, and that's exactly what he does. You try to give him a string or a date, and he'll laugh in your face. You'll get nothing unusual past him at compile time. He's purely a "what you see is what you get" type. Integer is about as trustworthy as they come. The String type is a little harder to read. He tells me he's simply a handful of characters that are supposed to represent any old literal string and, for the most part, that is what he is. But he can be deceiving. One time I discovered him in an application where he was holding numbers and dates. It was very disappointing. You think you know a type, and then you find out he's been playing games with you. Still, String can be a reliable data type. I think he just strays from the path once in a while. Some time ago, back in the era of ComponentObjectModule, I knew a data type named ComVariant. This guy was unlike any other type I'd ever met. He was an integer, a string, a SafeArray, and almost any other type you'd ever met before. At first glance, you couldn't tell exactly what he was. Despite his confused nature, Variant was always good about telling you what mood he was in. If he was feeling like an Integer, he'd tell you outright. You had to ask, but he'd be very quick to let you know. So, even though you couldn't determine his state immediately, he gave you very reliable means of finding out. And for that I was grateful. It wasn't until this Object data type rolled into town that I really started to question data types. Object was unlike any other type I had met before. He was the chameleon data type that could somehow be whatever he wanted to be. It was as if he had looked at all the other data types and asked if he could be something more, something that broke through all the type boundaries. This '60s, FreeLove spirit gave him a mystique that was extremely enticing. Naturally, this disposition also made Object a very popular data type. Everyone seemed to want to have him around. Object was clearly the life of the party, and pretty soon he became the "in vogue" data type that developers just couldn't resist. Object's appeal seemed rooted in something deeper than pure sex appeal. He really seemed to be adding value to applications. If you wanted to write a data container, for example, the Object data type allowed you to create a general container that could manage any type that could be represented as an object. Imagine how different the .NET Base Class Library would look if there were no Object data type. ArrayList, Hashtable, and the like--all staples of the BCL--are made possible by the existence of this type. Visit http://www.stickyminds.com/bettersoftware/magazine.asp for more information. '''Yeah, they'd have had to implement generics or templates right from the start instead of adding them in way too late. Then the language would've had something vaguely approaching compile-time type safety. Wouldn't that've sucked.''' --MartinZarate Uh, generics and templates are still a patch on static typing, to attempt some of the benefits of dynamic typing. When classes are also objects, much cruft goes bye-bye. --PhlIp