Easy Windows programming. (Microsoft Visual Basic for Windows 2.0 and ObjectVision program-development software and Microsoft Access data base management system)(includes glossary) (Software Review) (Evaluation)
by Tom Campbell
Making the leap into Windows programming is much easier than it once was. Five years ago, when I first hired a Windows programmer, it was a given that the candidate would know C intimately and that I'd have to spend nine months training that programmer. Now, there's a middle ground: programming systems for the rest of us. Three new products, Visual Basic and Access by Microsoft and Borland's ObjectVision, make programming in Windows simple enough to be possible for the novice yet powerful enough to be used by professional consultants.
COMPUTE chose these three programs among many other capable, "easy" development environments because each one strikes the right balance in a complex mix of features, stability, price, documentation, raw power, and third-party support. Each is relatively open, and each can be extended in some way using C. All of them allow you to program the application's user interface visually, using the mouse to position controls such as buttons and scroll bars. All are programmable to some extent, and all allow you to place Windows bitmaps in your applications and to interact with the Clipboard, DDE, and OLE.
The price range is dramatic: $149.95 for Objectvision and $199.00 for Visual Basic to $495.00 for Access. But that doesn't even tell the whole story. Borland offers generous runtime license terms for Objectvision, allowing you to distribute, at no extra cost, a version of the program that can be used to execute but not create applications. You can also distribute your Visual Basic programs. But Access doesn't come with a runtime module; for that, you pay an extra $495.00 for the Access Developer's Kit--a total investment of $1,000.00 if you want others to use your Access programs without owning Access itself. On the other hand, Access is a much more powerful tool than ObjectVision, and while both programs emphasize (but are not limited to) database development, it price is in line with similar high-end database developer's tools such as FoxPro and dBASE IV.
There's a point at which all such "easy-to-use" solutions begin to resist you, a point at which flexibility must lose to ease of use. I call this the wall, because there is no way to get over this obstacle when you come to it. You can do anything in Windows with C. You can do almost everything you need to do in Windows with Visual Basic, but at some point you may need a custom control or DLL written in C to get over the wall. Access reaches that point sooner for nondatabase applications, but it never comes close to the wall in databases. Objectvision hits the wall much earlier than the others, but it's a lot less expensive. When you are ready choose your next Windows programming tool, you'd better know just where the wall is.
Visual Basic--For Just Plain Volks
Arguably the most famous of this trio of products is Visual Basic 2.0, the Volkswagen of Windows programming. After the release of the DOS classic QuickBASIC in 1987, Microsoft seemed to be floundering a bit. But the release of Visual Basic in 1991 wiped away any doubts skeptics might have had that Microsoft pretty much owned the BASIC market. Visual Basic wasn't very compatible with QuickBasic 4.5, but the market responded appropriately, buying the product in droves because it made programming Windows easy and, well, fun. Programmers had used QuickBasic by the millions, but they understood that Microsoft couldn't be expected to retain compatibility with the masterful DOS product without fatally crippling Windows hackers.
Visual Basic lives up to its name, being both visual and basic. Its biggest departure from traditional BASICS is that you create the shell, or user interface, of the program first, plucking such items as push buttons, text boxes, and scroll bars from a toolbox at the left of the screen (don't worry, northpaws, you can move the toolbox anywhere) and positioning them on a window. Inexplicably, Microsoft, the company that invented Windows, refers to these windows as forms, not windows. You can have hundreds of these forms--windows--in a program. Visual Basic knows how to redraw them and the objects on them, a skill that saves you untold hundreds or thousands of lines of code per application. But this skill comes at a price: Visual Basic programs that haven't been scrupulously optimized for memory usage can bring the system to its knees for several seconds at a time, neither warning you nor deigning to put up that informative, if reviled, hourglass icon while it sorts out its memory situation. You then add code to these objects--forms, buttons, edit fields, and so forth--to create your program.
Each control has a property list that appears automatically when you select the item at design time, and property lists can easily run into the dozens of items. They are very well organized and ruthlessly logical, to the point that you can often guess the name of the property even if you're only semifamiliar with Visual Basic. Controls can also fire events, and all the events you'd like or expect are there for you to attach code to. For example, not only can you write custom code for a mouse clicking on the object, but you can also distinguish between mouse up and mouse down. There are events for the mouse merely passing over the object, key-up and key-down events, and so on. There are controls for editing text, all kinds of buttons, combo boxes, list boxes, bitmap images, and even a spreadsheetlike grid control for displaying, but not editing, data.
Notably missing from the standard edition are equivalents of QuickBASIC's OPEN COM, graphics, and IN and OUT statements. The graphics system is replaced by version 2.0's more Windows-like graphics controls and statements, but communications support is nil. You'll have to buy a third-party library or the Pro edition. As for IN and OUT, forget it. Windows is not very amenable to direct access to your PC's hardware, but you'll almost never need it, because Windows has most of what you need built in. Still, be forewarned.
Programmers of more traditional languages may suspect that this would appear to mean that a program can end up in the form of hundreds of little independent scraps of code and that a printout can be a real mess. You're right, and that's the good news! The bad news is that it took until the release of version 2.0 late in 1992 for Microsoft to give Visual Basic the ability to print properties as well. Not until version 2.0 could I recommend Visual Basic to any programming teams or to programmers who rely on printouts. You can print, and now when you enter programs in its built-in editor, keywords, comments, variables, and constants can be shown in different colors, allowing extremely quick syntax checking.
Visual Basic's most innovative feature is custom controls. Suppose, for example, you wanted to add low-level MIDI handling to Visual Basic. You could write a custom control using the new multimedia extensions, give it an icon in the shape of a musical note, and voila! Users could add that note to their toolboxes as if it had been installed at the factory. That's pretty much what Visual Basic Professional Edition is, as a matter of fact. For $495 you get additions to Visual Basic for graphing, communications, three-dimensional controls, high-level multimedia (no low-level MIDI, darn it), funky animated buttons, spin buttons, electronic mail, and more. With the package, you also get the Control Development Kit, which lets you write new controls in C, utilities to let you add real Microsoft Help to your applications, and support for Microsoft's ODBC, which is an attempt at forging a standard for communications among disparate computer types and other brands of databases.
Of the programs mentioned in this article, Visual Basic is easily the most versatile and certainly the most fun. The sample applications range from crisply competent to mind-boggling, its evolution has been swift and sure, its popularity is unparalleled in the Windows world, and it has a gigantic aftermarket. Visual Basic is so modular that the Pro additions were packaged in a separate, tragically unindexed manual and a couple of extra disks. I loved using Pro, but if you're on a budget, the standard edition of Visual Basic is the standout bargain of this group.
Access Makes the Heart Grow Fonder
Microsoft's star database program was years in the making and threatens to take firm control of the Windows market. That product is FoxPro 2.5 for Windows--no, wait! It's Sybase. No, wait! It's SQL Server. No, it's not any of those! It's Cirrus. At least that's the name you'll find on a few pages of the Access manual and one or two places in the online help. The product, of course, is Access, and I'll stick my neck out on this one. Access, code-named Cirrus during its turbulent six-year gestation, is by far the most significant microcomputer database product since dBASE II.
Access is a skillful blend of database manager, forms designer, reports designer, and BASIC dialect that makes every other data manager on the market pale by comparison. It uses Windows beautifully, always allowing you to do visually the tasks that ordinarily require laborious typing. In one memorable CompuServe exchange, a user bemoaned the fact that in dBASE he could copy a database in one line of code but that it took an unbearable number of operations in Access. He was unaware that all he had to do was copy and then paste using the Windows Clipboard! Truly, Access combines ease of use with extraordinary power in a way that no program since VisiCalc has been able to match.
Microsoft has made the mistake of marketing Access as an end-user tool, and it's certainly not that. Yes, a dedicated manual reader with a lot of time to spare could pick up Access, but it's not as easy as Microsoft claims. No program this powerful could be. If you're a database jock, you'll probably be simultaneously blown away by how easy some things are and stymied by tasks that a nondatabase user would find easy to accomplish. For example, Microsoft's FoxPro 2.5 for Windows does things in a very dbase-like way. Adding a push button to your data entry form requires either the use of FoxPro's automated screen designer, which generates trillions of lines of code behind the scenes, or detailed knowledge of FoxPro's use of READ/GET (if you're not a dBASE or FoxPro user, you can --and should--safely ignore this sentence). The upshot of it is that DBASE users moving to Access will have difficulty coming to terms with the idea that a push button on an Access program requires no code at all and that the READ/GET idea has no place in the Access way of doing things. Windows users who haven't yet been sullied by dBASE experience will, on the other hand, be instantly comfortable with this paradigm and would no doubt be horrified at the thought of having to cope with dBASE's consistent, if twisted, READ/GET scheme. The same goes for Paradox users, and it seems to me that Microsoft would have done well to include short chapters on Access for dBASE users, Access for Paradox users, and so on.
Having warned you that Access is like no other product, I can tell you the best thing about it: It's like no other product. I became so productive in Access in such a short time that I decided to convert my entire business to Access, even though I was in the middle of coding it in another language. It's that good. If you're reading this article because you're thinking of learning a new Windows language, mark my words. Access is the best way imaginable for you to start making money as a consultant. The lion's share of real-life consulting gigs requires database work. Since Access is a new product, you'd be well served to learn it thoroughly now, while it's new and you have a chance to become the first Access guru in town. There are hundreds of books on dBASE and millions of lines of useful code written in dBASE and its variants, such as Clipper and FoxPro. It's also reasonably simple to learn dBASE dialects. Until now, I've advised the would-be consultant to learn FoxPro or Clipper for those very reasons, and I take tradition dead seriously--maintaining old code is usually a programmer's bread and butter. Clipper may not be state-of-the-art, but it supports an awful lot of freelancers. So when I tell you that Access is so much better than these trusted standards that you should make it your first database development system, you must realize that it's not a snap judgment on my part.
And to some extent, you can hedge your bets, because Access can use Paradox, dBASE, FoxPro 1.0, and BTrieve files as easily as its own proprietary format. This lets you audition Access while using the data files you're used to, quite possibly without disrupting daily operations at all. Once you get more committed to Access, it can convert them to its own format transparently. Microsoft once had a history of ignoring the market leaders when it came out with its own products and then wondering why people didn't go for an obviously superior solution. Excel started a new trend with its 1-2-3 macro and worksheet conversions, Word for Windows continued the trend by bending over backward trying to accommodate WordPerfect users, and now Access is going for the jugular by offering data file compatibility with all the current market leaders. This is good because it allows cautious users to make the transition at their own speed. (Ironically, Access won't handle FoxPro 2.0 or higher data files, even though FoxPro is a Microsoft product, but full version 2.0 compatibility will happen soon.) Access also surpasses every one of its competitors in its handling of multiple related databases, using an extension of the industry-standard SQL language that takes advantage of the standard while filling in its holes.
If you're still not ready to program, you can go a long way in Access with its macros, Much more than a keystroke-recording utility, Access macros are displayed in their own database grid and look a lot like English. You can create and edit them interactively to produce a turnkey application without ever knowing Access Basic. You can also start off by adding tiny snippets of Access Basic to formulas or user interface objects and working up from there, supplementing your macros with Access Basic as necessary.
When you're ready to go all the way and dive into Access Basic, you'll find it well documented in two of its four superb manuals. If you're a Visual Basic user, you'll find Access happily similar to it, but as Microsoft is wont to do with its wild profusion of BASICs, it's neither binary nor source compatible with Access. Unlike the switch from QuickBASIC to Visual Basic, which was painful but necessary, I'm on the fence about Visual Basic versus Access. The addition of a C-like SWITCH statement was fine, because there was nothing like it in Visual Basic, but incompatible handling of properties is much less forgivable.
My complaints about Access are so picayune that they serve only to illustrate how well conceived the product is in general. Access calls databases tables, which is fine, but it calls the entire application (which consists of tables, forms, reports, program code, macros, and queries) a database. Ouch! It also lacks a way to create databases--uh, tables--under program control, so if you're writing an application for someone else, you must include empty databases--that is, tables--to ensure they can get started. And as stated, distributing an application to someone who doesn't own Access requires the one-time purchase of Microsoft's $495 Access Developer's Kit, which contains nothing more than a chopped-down version of Access that can't be used to create programs. Given that this is only the first version of the product, I'm astounded I couldn't come up with more substantial problems.
ObjectVision--A Cloudier Picture
Borland seems to be stumbling a bit with Objectvision, but it's still a worthy product. Objectvision lets you design and use databases in dBASE, Paradox, and Btrieve format. You can make use of all the standard Windows controls such as list boxes, radio buttons, and so on. Objectvision doesn't exactly sport a programming language, but you can build complete applications using what looks like a flow-chart designer. I have never felt entirely comfortable with this approach, but many other users took to it like ducks to water. More objectively, the program lacks certain classics such as loops, and you have to kludge substitutes.
Like Access, Objectvision lets you create data-entry forms that simultaneously update databases in any or all of its supported database formats, and it makes database design and querying a snap. There's full Windows font support for its forms and reports; as long as your application remains simple, you can go from nothing to a ready-to-go application in a matter of hours. If you work for the kind of client who likes to hover around until every field is spaced just so, Objectvision won't let you down. Better, it costs a mere $149.95-and that includes the rights to a runtime module that you can distribute freely with your applications. But it hits the wall earlier than Access or Visual Basic. Borland's solution is Objectvision Professional, but I found it by far the most difficult to use of all these systems. ObjectVision Professional is a loose bundling of Borland's older C++ development system for Windows, and the documentation on extending Objectvision with C is absolutely atrocious. At $495.00, it's simply too complicated, too expensive, and too badly documented to compete with Access at that same price.
Which is Right for You?
It's not hard to find a constituency for each of these products.
Visual Basic is the hands-down winner for versatility, offering the best feature-per-dollar value. If you're a hobbyist or if you aren't quite sure which direction to go, you can't go wrong with Visual Basic. If money is no object or communications support is of utmost importance, get the Pro edition, but the standard edition is a tremendous value. You can distribute your programs free.
Access is your only choice if you plan to do extensive Windows database development. It took six years to write Access, and that care shows. Its BASIC, while not quite as rich as Visual Basic, makes it as capable as any other database now on the market. What pulls it past all its Windows and DOS competitors is a tightly integrated development environment second to none. Access is not simple to learn, but it is incredibly simple to use and will make you more productive than any other database product. Use it if you plan to develop inventory, accounting, PIM, or office automation programs. If you will want to distribute your programs to nonusers, you'll need to spring for the $495 Developer's Kit, so be sure to budget for both if necessary.
Objectvision will get you in and out of simple database chores with the least trouble of any of these, but it will also get you into trouble faster because it's the least programmable. If you don't want to commit to a full development system, ObjectVision's seductive $149.95 price may be all the persuasion you need. Just make sure your programming needs will never go beyond simple, because you may not get past the wall.
All of these three new development environments are powerful, capable, well supported, and good investments. Be aware of your current needs, experience, and future needs. Then it will be clear which system is for you. Soon you'll find that programming in windows is as easy as pie.
Although the programming environments covered in this article are all pretty easy to use, sometimes the jargon gets to be a bit much. Here's a translation of some of the less obvious terms.
binary and source compatible. Visual Basic and Access Basic programs go from an English-like appearance, as in Printer.Print "hello, world", to a predigested form that BASIC can run more quickly. The first representation is called source, and the second is called binary.
custom controls. A function in Visual Basic. Custom controls let you draw buttons, combo boxes, and so forth on a form from a toolbox that C programmers can extend. Adhering to a relatively simple set of programming guidelines, C programmers can create custom controls that automatically appear on the toolbox, as if Microsoft had supplied them with Visual Basic, without changing Visual Basic itself.
DDE. Dynamic Data Exchange. DDE is the precursor of OLE and a way for Windows applications to communicate. This lets programs control other programs behind the scenes without the user's knowledge or interference. See OLE.
development environment. The overall set of tools a programmer employs to create Windows applications. For example, Access lets you design databases, enter data, create labels, program in BASIC, and so on, each in separate program modules. These modules are seamlessly integrated into the Access development environment. Likewise, Objectvision's development environment consists of different modules for visual program design, database creation, data entry, and so on.
DLL. Dynamic Link Library. DLL is a standard form of program that virtually all Windows programming environments can use; consequently, a DLL written in C can be used from Pascal or BASIC. Windows itself is a collection of DLLs. It's important that a programming environment be able to use DLLS so that third parties can fashion solutions not possible in that environment.
easy to learn. Easy to acquire knowledge, as opposed to putting it to good use. It's easy to learn how to jog, for example, but it's not easy to run a marathon. See easy to use.
easy to use. Easy to put knowledge to work on a routine basis. If you're a good typist, then taking your hands off the keyboard to copy text to the Windows Clipboard is counterproductive, even though the Clipboard is easy to learn. But if you've learned the product and have discovered that you can also copy using Ctrl-C, which isn't quite as easy to learn as using the mouse, then you'll find that product much easier to use.
event driven. Programs, that work according to menu commands and mouse clicks are event driven. It turns out that writing a program that can respond to a Cancel button at any time or that allows the user to choose Exit from the File menu at any time requires a much different perspective than writing a program which forces the user to do things in a particular order. Programming Windows in C requires an enormous amount of forethought because you have to account manually for every possible click and command, tasks that the programming tools in this article handle as automatically as is possible.
OLE. Object Linking and Embedding. In practice this means the ability to represent as pictures or icons in a program the application that created them. If you create a logo in the Microsoft Draw applet that comes with Microsoft Word, you can double-click on that logo, and OLE will automatically kick Draw into action, without your having to know what and where it is.
runtime distribution. Writing a program in a programming language doesn't necessarily mean you can give it away. That's because some languages require that the development system be present for the program to be run. Since you may not be able to afford to buy a copy of Visual Basic for everyone who uses your program, for example, you'll need to use its runtime module. The runtime consists of a version of the language that can be used to execute but not modify programs written in that language. When you purchase a programming environment, you must find out whether distribution is free; some companies charge a substantial amount for each copy you Distribute.
text box. A tiny, stripped-down word processor that lets y6u enter up to 32,000 characters in a programmer-defined box onscreen.
VisiCalc. The first spreadsheet, a precursor to 1-2-3. VisiCalc is significant in that it allowed users to manipulate numbers instantly and through direct visual interaction, which was impossible before computers. It's considered a breakthrough product for that reason.