This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.
|
Visual J++ 6.0 Sneak Preview Jonathan Locke |
Its a development environment! Its a new way of tackling Java development! Its a dessert topping! Visual J++ 6.0 lives up to all your wildest expectations. In fact, its 5.0 better than version 1.0. |
If you have used Microsoft® Visual J++ 1.0 or 1.1 in the past, you are going to find Visual J++ 6.0 to be a major step forward. It is immediately obvious that Visual J++ 6.0 was rethought and redesigned from the ground up. And, not unexpectedly, the resulting product is a great deal more usable and has a plethora of new features.
What's New?
Creating a Project
Welcome to the Visual J++ Environment
Adding an AboutBox Dialog
|
private void aboutMenu_click(Object sender, Event e)
{
}
The Designer-maintained code is then changed to include a line that hooks up the event handler:
aboutMenu.addOnClick(new EventHandler(this.aboutMenu_click));
I add a new item to the VJ6WizTest project by right-clicking on VJ6WizTest in the Project Explorer, selecting Add,
then selecting Add Form. The resulting dialog is shown in Figure 9. I then add a form called AboutBox to my project. The AboutBox form is really just a stripped-down version
of the JPad form. I drag a text label and a button from the WFC Controls toolbox to the form and change the titles of
each control by using the property editor.
private void aboutMenu_click(Object
sender, Event e)
{
AboutBox a = new AboutBox();
a.showDialog();
}
This creates an AboutBox form and displays it. Hooking up the OK button to close the AboutBox is accomplished by simply changing the cancelButton property for the form to button1 (the name of the OK button). Figure 10 shows the final result.
aboutMenu.addOnClick(new
EventHandler(this.aboutMenu_click));
What does this mean? Well, EventHandler is a new language feature specific to Visual J++. It's a type-safe method pointer created using a new language feature called a delegate. A delegate is declared at the class declaration scope like this:
delegate long intOp(int a, int b);
When compiled, this creates a class called intOp that extends com.ms.lang.Delegate. This class can then be instantiated with the new operator, passing in the name of a target method to invoke as an argument to the constructor. Figure 11 demonstrates how to work with delegates. The newly constructed delegate object (called op in the code shown in Figure 11)
can then be used to invoke the method to which it points. This is done by calling the delegate's invoke method, passing arguments of the same types originally declared in the delegate statement.
IntelliSense
In working with the DelegateTest example and the code generated by the New Project wizard, I was very happy to find IntelliSense® technology in Visual J++. While you type, Visual J++ is constantly in the process of evaluating your code. When compiler errors occur, you know about them instantly because the Task List is updated to include the errors, and squiggly red lines underscore your mistakes on the screen (just like they do in Microsoft Word). When classes and methods are declared, they immediately become part of the environment's knowledge
of your code. This knowledge is used to help you complete code statements.
For instance, when I typed the statement in the DelegateTest example that reads op.invoke(10, 5), typing just "op." caused a dropdown to appear, containing the various methods that I might choose to complete the statement. I typed "in" and hit the spacebar. IntelliSense then completed the word with "voke." I then typed a left parenthesis and IntelliSense provided a tooltip showing the method's prototype as long intOp.invoke(int a, int b). The wonderful thing about this kind of assisted coding is that it's really easy to get used to. The downside is that it can be kind of addictive.
Debugging
The Visual J++ debugger has come a long way. This latest version is very usable and has addressed all my criticisms of Visual J++ 1.0. One particular gripe that I'm happy to say has been resolved is the debugger's handling of exceptions. In Visual J++ 6.0, the debugger lets you use the exception class hierarchy when setting exception handling options. For each exception in the hierarchy, you can choose "Break into the debugger," "Continue and break only if the exception is not handled," or "Use superclass setting." The UI is neat, intuitive, and gets the job done quite nicely.
Most other features of the debugger are similar to the previous version, if not identical. You can expect the usual auto, local, and watch windows in addition to tooltips for variables and a call stack dropdown. In general, debugging with Visual J++ is now much closer to what developers have come to expect from Visual C++. In fact, Visual J++ now even supports interprocess (and intermachine) debugging as well as integrated script debugging. Unfortunately, integrated native C/C++ debugging isn't supported yet. I imagine this would be quite a trick, though, and I'm happy enough to wait for support in some future version.
Other Extras
Visual J++ 6.0 has support for ActiveX Data Objects 2.0, which means scalable, high-performance data access to any data source on any platform. Access to data services can now be achieved through HTTP. To assist in the design stages of a database project, Visual J++ 6.0 includes a SQL Query Designer and a full-featured Database Designer. The Query Designer is useful in constructing database queries, while the Database Designer can be used to create and modify database tables and schemas visually.
The Visual J++ class browser appears in the Class Outline pane, replacing the Designer's toolbox. The class browser is even better than the last version (which I thought was fairly nice in its own right), and includes lists of superclasses and inherited members. In addition, right-clicking on class browser items unveils some useful options, including the ability to go to the definition of a given item, override a method, add a method, create a class, add member variables, and invoke a class builder on the class. The class builder is an interface for modifying classes.
In addition to the basic coding tools, Visual J++ has a few nice bells and whistles that deserve mention. An integrated WYSIWYG HTML editor is included. The editor supports script authoring features, integrated source control management, and Microsoft Transaction Server 2.0. Project deployment options are available to help speed your project releases. There is a help system, but the prerelease version I reviewed was rather incomplete in terms of content. The ability to define window layouts and recall them at a later time (the environment comes with a variety of useful predefined UI configurations) is also a plus.
Conclusion
All in all, Visual J++ 6.0 is miles ahead of the 1.0 version and looks to be a very useful and powerful development environment. Visual J++ 6.0 doesn't provide much new assistance for cross-platform development (although it still supports it), but if you're primarily targeting the Windows platform you will find this packageand WFC in particulara much improved development tool.
From the July 1998 issue of Microsoft Interactive Developer.