Classic Computer Magazine Archive COMPUTE! ISSUE 164 / MAY 1994 / PAGE 32

Taking a look at Visual C++. (application development software) (Software Review) (Evaluation)
by Tom Campbell

Tom Campbell

Visual C++ is probably not news to you. Microsoft released it a year ago, but I held off talking about it until I'd done some real-life projects with it. Too many reviews of Visual C++ have been little more than reprinted press releases, because Visual C++is a massive product and it takes a while for anyone to grow accustomed to such a revolutionary change of environment.

For those of you who have just been released from Biosphere II and don't know about Visual C++, here's a thumbnail sketch. Visual C++ is a complete revamping of the Microsoft C/C++ development environment, almost all Windows hosted (at last) and emphasizing C++ over C. In effect, the astounding Microsoft Foundation Classes (MFC) C++ class library is the new Windows API. A number of incredibly useful tools called Wizards will step you through the creation of C++ apps of medium complexity, but they fail miserably when you have to step outside their limits.

For example, I'm writing a database that has spreadsheetlike views of the data, along with form views. The best way to do that is to use MDI child windows, but the Class Wizard tools only support a single type of MDI child, though MFC suffers no such limitations. The creation of Windows resources (such as dialogs, cursors, icons, bitmaps, and even the Alt-accelerator keys) and their maddeningly complicated resource scripts is handled beautifully by AppStudio, as revolutionary a departure from resource creation compared to the old C SDK tools as Visual Basic is from C. The price of all these toys is 50 to 60 megabytes of disk space, perhaps even more, for a typical development system. Don't skimp on RAM, either. You won't like developing on a 4-meg machine. It's just too slow.

I still haven't completed any major Windows applications using MFC, but I'll stick my neck out and say that it's the best class library I've seen for Windows. I noticed no speed degradation in my apps, and the extra 100K it adds to a typical program is more than justified. Even juicier, not long after you read this, your MFC applications will run unchanged on the Macintosh. (So will your Visual Basic programs, for that matter, but those using custom VBX controls won't.)

To Microsoft's credit, while it strongly encourages the use of C++, Visual C++ has made creating C applications easier than ever. I reluctantly moved a sizable C project to the Visual C++ environment and was duly rewarded by background compilation, a decent if not spectacular editor, and the incredible luxury of AppStudio.

I found few bugs in the development environment and none in the compiler. AppStudio allows you to open up as many windows as you like. While attempting to steal enough artwork from my Visual Basic icons to create an icon for my own program, I found that AppStudio died if I opened a dozen or so icons at once. This bug will no doubt have been fixed by the time you buy Visual C++.

Another "bug," already widely remarked on, is the lack of template support. If you do an FC on the source for Visual C++'s dynamic array classes for bytes, integers, words, strings, and so on, you'll notice that they're exactly the same except for changes in the names of data types. This is not just a matter for reviewers' checklists. It bespeaks a very real maintenance issue. Anytime code is duplicated like that, you can expect problems to occur down the line when one file is changed but not another. Templates would eliminate that concern here.

On the plus side (if I may be permitted an obvious pun), and far outweighing the maintenance problem, is the very fact that the MFC source is provided and even licensed to other C++ vendors. That was a stroke of pure inspiration and a great relief to underfunded developers like you and me.

So that's what Visual C++ is--by far the best Windows and Macintosh C++ development environment I've used. Here's what Visual C++ is not. It's not a Visual Basic equivalent, despite the name. Visual Basic allows you to dispense completely with anything remotely like the Windows API for the window and control logic of a typical application. Visual C++ is also not for Windows programming neophytes. There's no equivalent to Charles Petzold's classic Programming Windows book in the package. There's a very good C++ tutorial. And the walk-through of the construction of a sample MFC app is also very good--if you already know the Windows API. Otherwise, it's just a good exercise in typing.

If you want to learn how to program Windows with MFC, I strongly recommend David Kruglinski's Inside Visual C++, a 1993 book from Microsoft Press. It's a superb primer on MFC, and it doesn't assume you're a C++ expert. I can't recommend it highly enough. I only hope that he writes a book on OLE 2.0.

Visual C++ is a brilliantly conceived development environment for C++ with a great class library for Windows programming. Easy to learn? No. Easy to use? Absolutely.