Columns

Microsoft's solution to Java programming - Visual J++

Web pages are popping up everywhere, giving the world access to just about anything the human mind can imagine. While this has raised some legitimate concerns for many people, most would probably agree the technological benefits far outweigh the risks.

Visual J++
Microsoft Corp.
Redmond, Wash.
425 882-8080

May I suggest exercising extreme caution before venturing into any new development environment? One can never be too careful about selecting the right tools. A wrong decision can cause serious premature aging in your development staff and bad things in your delivery schedule. Not that I am implying that Redmond, Wash.-based Microsoft Corp.'s Visual J++ is not a wise choice. On the contrary; I would have to give it a thumbs up. The Java language in general is not my favorite, at least not in its current evolution, but I will admit that Visual J++ is an excellent solution to Web programming.

I installed the Professional Edition of Visual J++, and as expected, it was quite painless. The first and most obvious thing about Visual J++ was the remarkable similarity to Visual C++ 5.0. If you are a seasoned Visual C++ 5.0 user, you will find navigating through this product very familiar. The product contains one well-written book entitled "Learn Java Now," which includes code samples in entirety.

A LITTLE BACKGROUND INTO JAVA

Syntactically, the Java language is similar to C++. It is completely object-oriented and machine independent. It boasts of being a secure programming language because it cannot access anything in the client computer unless the client computer grants the access. Java can be used to develop apps, which are designed to run independently of the Web, and applets, which are designed specifically for the Web. When the Java programs are compiled, the output is known as Java byte code. Java byte codes are instructions written for a virtual Java machine that do not actually exist. A Java-aware browser must be used to interpreting these byte codes and running the program, or, alternatively, recompiling the byte codes into native code.

HELLO WORLD

It is a tradition. All Microsoft tutorials have one. It is the "Hello World" program. Let's journey through the steps needed to build a very simple app, not to be confused with an applet. You choose the "new" command from the file menu. In the new dialog box, select "text file" as the type of file to create and click "OK." Then you can enter your source code.

APPLETS BY HAND OR WIZARD

Most of my time was spent investigating the product through the applet development. You can develop the applet by hand or use the Applet Wizard, a utility built into Visual J++. It automates several steps. When you use the Wizard, Visual J++ prompts you with a series of five dialogs. The first of these allows you to set the basic application/applet parameters. Later dialogs in the series allow you to decide if you want an automatically generated Web page, to set the applet's display size, to select threading and animation options, and so on. It creates the necessary classes and Java (source) files needed to support the most common programming options, builds the stubs for a set of methods to support those options and adds comments, if you desire, to direct you in your coding. Finally, it will build the HTML file (Web page) needed to connect to your applet. I advise even the most experienced programmers to create a shell applet by hand at least once to get a real understanding of what is going on behind the scenes.

Microsoft Visual J++ will build a project to allow for immediate coding.
The Visual J++ window has the right pane showing the current source file. Alternately, it can display a set of subwindows, each displaying a different source file. The left pane is a tabbed pane. Tabs let you select from the class browser, file browser and info browser. The file browser presents all of your source files and resources in a logically structured tree diagram.

PRODUCT LOOK AND FEEL

The graphical interface is crowded and a bit overwhelming at first. It takes some time to become comfortable with the many toolbars, icons, windows and menu items. Again, if you are familiar with Visual C++ 5.0 this will probably not be an imposition. Visual J++ offers a full page view, which is particularly beneficial if you just want to view or edit your source code, without the busyness of the many other graphics intruding on your space. Once I entered this full-page view, however, there was no "clue" on the window as to how to return to the previous view. Users need to know off the top of their head that the escape key or the smaller "overlapping window" box in the upper right will return to the previous view.

The online help is what one would expect from Microsoft. It is informative, easy to use and intuitive. It contains the Infoviewer which allows you to specify queries and define subsets of material to search. It supports a pseudo language to allow for intelligent searches. You can use commands to further narrow down your search. The product also provides help for the keyboard map, a direct connection to Microsoft on the Web, a special technical support section, and of course, a "Tip of the Day" feature. The Visual J++ specific help part of the product is excellent. It contains invaluable information about the product and is well organized.

OTHER FEATURES OF MICROSOFT VISUAL J++

The debugging abilities of Visual J++ are sufficient. It offers views of memory, variables, watch windows, registers, the stack and the assembly language. There was nothing exciting or innovative about the debugging facility; maybe I am becoming spoiled in my old age. A feature I was unable to find was a list of breakpoints. This is a favorite feature of mine because a typical debug session requires multiple breakpoints to be set and cleared. It is very helpful to be able to view which breaks are set without actually going into all the source files to look for the "dot." Debugging without a list of breakpoints readily available can be quite annoying. This feature exists in early versions of Microsoft products, and I am convinced it is available in Visual J++ as well, but I could not find it.

Microsoft Visual J++ supports multithreading through its thread class. Multithreaded programs execute threads in the same memory space. What that means is multiple events are taking place on the home page. A ticker can be scrolling in one area of the screen while an animated object is dancing around in another. To create a thread, you instantiate the object, or let the Wizard do it for you. The resource facility of the product is interesting. It can be used to design new dialogs, bitmaps, string tables, menus, icons, toolbars -- you get the picture. You can also import custom resources.

Now, for the bad news . For those who have become spoiled by the Wizards available in Visual C++, brace yourselves. You are in for an abrupt awakening. The resources used in Visual J++ need to be created on the fly via source code. You actually have to instantiate the controls and add them to the Window.

The good news is there is a Resource Wizard option available that does the grunt work for you. It will create a .Java file (comparable to a .cpp file) that performs the code needed to display the controls. This particular wizard will also work for .rc files, or resources created in Visual C++. As far as retrieving data from the controls, you are on your own. There is no DDX type facility used for data exchange -- you have to write the code manually. Although the code to be written is simple, it is just cumbersome. Visual J++ by design forces object-oriented design on the developers, which is a real treat for anyone who has ever tried to maintain poorly designed code. At a minimum, the shell is familiar across all Visual J++ programs. It is unfortunate this same standard was not incorporated into the data retrieval logic.

A source control system is built into the product. While time did not permit venturing into its functionality, it appears from the menu options to be complete. This feature is a personal favorite of mine, since I so frequently forget to release files or version stamp "milestone releases." When it is right there on the menu, it is hard to be forgetful -- or lazy as is sometimes the case.

OTHER USEFUL TIDBITS

Microsoft Visual J++ has a complete set of APIs and sample code available to the developer. I could spend a month, at least, just browsing the documents in the online help system. Visual J++ is the first compiler on the market that takes full advantage of Java support in the Internet Explorer.

If you would like a closer look at this product, there is a multitude of information available. Microsoft mentions three sites in its documentation as the best source of Java information: //www.javasoft.com is a site run by the originators of the Java language and is full of generic information; //www.microsoft.com/visualj/ is a site run by the Visual J++ developers and is the best source for Visual J++ specific information; and //www.gamelan.com is a clearinghouse for Java information. All three maintain links to other Java sites.

About the Author

Cynthia L. Paxson works for the National Software Testing Laboratories in Conshohocken, Pa.