Keith E. Bugg
Microsoft threw its hat into the Java ring with the introduction of Visual J++. Here’s a review of the new contender. You’ll be surprised how easy it is to add Java to your development arsenal. And we promise not to pummel you with coffee metaphors . . .
The ubiquitous rise of the World Wide Web has spawned a need for new Web-specific development tools, especially tools that work with the Java language. In the past year, all of the major compiler vendors have been scrambling to provide their Java solution. Microsoft’s recent announcement of Visual J++ confirms that Java has emerged as a significant Web development language. In this article, I’ll examine this product and explore some of its features, strengths, and weaknesses. (But be apprised, this article is based on the beta release of Visual J++, so the product you find on store shelves may have some minor variations.)
The good news for all Visual C++ users is that Visual J++ has the same look and feel. Just like Visual C++, Visual J++ provides an application wizard (Applet Wizard) to guide you through the creation of a Java skeleton applet or a stand-alone application. Organized in five steps, the wizard lets you specify multithreading, animation, and other features, such as a sample HTML file with your applet’s name set up and ready to run. Multithreading and animation are the default options; I easily created an image of a rotating earth and a hypertext link to the Java source code. Pretty cool stuff just for the price of a few mouse clicks.
The recommended system configuration for Visual J++ is very similar to the configuration for Visual C++:
A 90 MHz Pentium-based computer with 24M of RAM.
Windows 95 or Windows NT version 4.0 (Windows NT versions 3.1, 3.5, and 3.51 are not supported).
55M of free disk space is needed during the WebBeta installation process. After installation, Visual J++ itself occupies 35M.
You’ll also need a Web browser such as Microsoft’s Internet Explorer version 3.0 so you can run the HTML files that Visual J++ generates. While 24M of memory is recommended, I was able to run it with 16M on a 90 MHz Pentium. The workbench was a little sluggish while loading, but the compiler seemed blazingly fast (it’s rated at over one million lines of code per minute). Of course, your mileage may vary.
After you’ve installed the product, you can take a test drive; in fact, that’s the name of the option in the InfoView window. The Test Drive consists of several scenarios that acquaint you with the workbench environment, as well as the development of applets and applications. If you aren’t already familiar with the motif of Microsoft’s standard Visual C++ IDE, taking the test drive can significantly reduce your learning curve for Visual J++.
It would be superfluous to discuss the features of the development environment, because it’s identical to what you’ve used before in Visual C++. All the standard stuff is there-dockable toolbars, online help, F1 help, build errors help, and so on. Of course, the debugger is identical to the one in Visual C++. As for Java itself, the source editor is compliant with HTML version 2.0, as well as Internet Explorer versions 2.0 and 3.0. Visual J++ inserts source code comments-which I found to be very, very helpful and somewhat more descriptive than those produced in Visual C++ projects. Not only did they serve as useful reminders, but they seemed to narrate the general flow of the code. This makes Visual J++ an excellent tool for learning the Java language.
Menus and dialog boxes are normally created with Java’s AWT (Abstract Window Toolkit), but Visual J++ includes a tool called the Resource Wizard that lets you convert menus and dialog boxes from existing Windows resource files into Java code. Also, you can easily create a Visual J++ project (in other words, a workspace) from Java files created using other tools. All you need to do is compile them under Visual J++; it will automatically create a workspace for you. As an experiment, I tried mixing Java files created with Symantec’s Caf product, which is also a visual development tool. Visual J++ built the project without whining. Also, I was able to take Java files developed with Visual J++ and build them under Caf.
Visual cues in the project workspace window ClassView tab are an excellent feature (see Figure 1). For example, methods defined as private are displayed with a lock icon; public methods don’t show the lock. This is much better than showing, say, an open lock-a lot less screen clutter. The same technique is used with member variables-private members have the lock icon. And better yet, thread variables have their own unique icon-look at the variable m_Test, a thread variable, in Figure 1. You can ascertain the variable type just by looking at the name. This is quite a handy feature when your projects start getting big. And if you need to see where the method/variable was defined, all you have to do is double-click it in the ClassView window and the source window scrolls to its definition. This really facilitates the edit process.
Figure 1. Use of icons in ClassView.
There are also plenty of sample applications that demonstrate just about everything you’ll need, from the mundane to the esoteric. The sample code comes in two flavors-Sun and Microsoft. The Sun examples seem to be geared more toward multimedia, while the Microsoft stuff leans more toward sophisticated topics such as dynamic data binding, calling COM (Component Object Model) objects, and so on.
One of the files Visual J++ builds for you is an HTML document that is named the same as your applet. All you need do is fire up your favorite browser and open this HTML document to see your applet in action. The following code illustrates what you get (using a project called Test):
<html> <head> <title>Test</title> </head> <body> <hr> <applet code=Test.class id=Test width=320 height=240 > </applet> <hr> <a href="Test.java">The source.</a> </body> </html>
Another nice feature, especially from a project management point of view, is the inclusion of applet author information, which can be retrieved by the getAppletInfo() method. This next code snippet, based on a sample applet I created, details what goes into your main Java file:
// APPLET INFO SUPPORT: // The getAppletInfo() method returns a string // describing the applet's author, copyright // date, or miscellaneous information. //-------------------------------------------- public String getAppletInfo() { return "Name: Test\r\n" + "Author: Keith Bugg\r\n" + "Created with Microsoft Visual J++ Version 1.0"; }
Visual J++ sports another nice feature-MSDN compatibility. The InfoViewer can be used to access information from the Microsoft Development Library without having to start another application. This can be a really big help when you need to lay your mitts on material from the MSDN CD. Of course, this gives you access to all the standard documentation/reference aids like Annotations, Bookmarks, and so on.
Another nice thing about this tool is that it lets your applets communicate with other applets, with COM objects, and with ActiveX controls on your Web page. That’s a lot of horsepower, buckaroos, and I predict that some really elegant applications for Internet commerce incorporating these features will show up on store shelves soon.
All in all, I give Visual J++ high marks. You might say I liked the lyrics and it’s got a good beat. My judgment is tempered by a long association with Visual C++. To move to a new language but keep my experience from the old environment is a big plus-I don’t have to learn a new tool, which lets me concentrate on developing my application. I really liked the source code commenting-I think it’s superior to Visual C++, and I’m pretty biased towards that product. I wouldn’t be surprised if Microsoft incorporates some of the features found in Visual J++ in future releases of Visual C++. Visual J++ should cost about $100, and comes bundled with Microsoft’s ActiveX Workshop. If you’re looking to take the Java plunge, check out Visual J++.
Keith Bugg has been writing Visual C++ applications since the release of version 1. When he’s not programming, he enjoys brewing beer and riding his ATV. tristar@qsystems.net, http://www.qsystems.net/tristar/tristar.htm.
To find out more about Visual C++ Developer and Pinnacle Publishing, visit their website at: http://www.pinppub.com/vcd/
Note: This is not
a Microsoft Corporation website.
Microsoft is not responsible for its content.
This article is reproduced from the December 1996 issue of Visual C++ Developer. Copyright 1996, by Pinnacle Publishing, Inc., unless otherwise noted. All rights are reserved. Visual C++ Developer is an independently produced publication of Pinnacle Publishing, Inc. No part of this article may be used or reproduced in any fashion (except in brief quotations used in critical articles and reviews) without prior consent of Pinnacle Publishing, Inc. To contact Pinnacle Publishing, Inc., please call (800) 788-1900 or (206) 251-1900.