Chapter 1

The Spirit of Basic

Every computer language has its own feel, its own atmosphere, its own spirit. You canít really define this spirit, but you know what it is when you see it. I think of Basic as the antithesis of a statement attributed to Albert Einstein:

Make things as simple as possibleóbut no simpler.

Had that quote been written by the original designers of Basic, John Kemeny and Thomas Kurtz, it would have been simplified further:

Make things simpler than possible.

That is the contradiction hardcore Visual Basic programmers live with. We want things to be simple, elegant, and intuitiveóbut they arenít. We want our programs to model realityóbut they donít. We want our language to work the way we think, not the way computers or operating systems want us to thinkóbut weíre not willing to pay the price.

The nebulous Spirit of Basic exists only in our minds. Real implementations of Basic, including Microsoft Visual Basic, have to compromise. Sacrilege keeps creeping in. Thereís an inherent conflict between the desire to keep it simple and the desire to do what needs to be done, whatever the cost. I use the term un-Basic to describe these compromises, whether they are built into the language or built into our code.

This book tries to maintain the Spirit of Basic, against all odds. Sometimes itís tough. First, the book deals at length with the Microsoft Windows Application Program Interface (API), which was written in C and is permeated with the Spirit of C. Second, the bookís philosophy is to accept no limits, although Visual Basic has built-in limits that can be overcome only with great effort. Third, Basic is slowly becoming an object-oriented language, but it remains to be seen how well objects can be realized in the Spirit of Basic. Version 4 made a good opening argument. Iíve been disappointed by the slow progress in version 5. Maybe next timeÖ.

Despite the inclusion of techniques that can only be described as un-Basic, this book is not about how to write C in Basic. Iíll try to keep things Basic and to wrap un-Basic code in wrapper routines so that you can use it without constantly thinking about the heresies involved.