Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Microsoft's Visual J++ 1.0


December 1996: Microsoft's Visual J++ 1.0

Java programming tools are evolving at an incredible pace. Not to be left

without a Java strategy, Microsoft has introduced the newest member of its

development tool family: Visual J++. A licensed implementation of Sun's now

famous programming language, Visual J++ isn't just another wrapper around the

Java Developer Kit (JDK). Instead, Microsoft's language team has once again

demonstrated its expertise at building a high-performance, feature-rich,

professional development tool.

What is so special about Visual J++? For starters, programmers familiar with

the tried and true Developer Studio IDE (of Visual C++) will feel right at

home. Since the Java language itself is "an improved C++," the learning time to

add the new language to your tool chest is cut down by not having to master a

new development and editing environment. For those of you who aren't familiar

with Developer Studio, you'll find that the integrated set of editing,

debugging, and documentation make the task of building complex programs easier

than managing a suite of separate tools.

When you start up Visual J++, which I took a look at in beta, you are

presented with the Developer Studio opening screen, from which you can easily

start a new Java project using the Java Applet Wizard. To do this, you select

"New..." from the File menu, and then select Project Workspace from a list of

file and project types. This is standard fare for working with Developer

Studio. Next, after assigning a project name, you can select a blank workspace

or a Java Applet Wizard. Unlike a C++ project, you don't have any choices of

target platforms in this dialog. This is because the Java virtual machine is

platform-independent. This of course is one of the advantages of using Java

instead of C++.

A Solid Start

Once the wizard has your project name, you choose whether your program will

run only as an applet, or will be able to function as both an applet and as an

application. The difference is that applets cannot run outside the protected

environment of a World Wide Web browser program (like Microsoft Internet

Explorer 3.0, which is required for Visual J++). During this preconstruction

phase, you also choose whether you want the generated source code to be

commented or to go naked. I prefer the commented code, as the wizard inserts

clear explanations throughout the generated source code. These in turn are

helpful to come up to speed on the language. If you learn by looking, like I

do, then be sure to turn these on. Two types of comments are possible, these

being explanatory and "to do" comments. The latter instructs you where normal

application housekeeping would appear in the generated code.

Since the programs you generate with the Applet Wizard are always capable of

running inside a web browser, the wizard will generate a sample HTML page for

you. If you've never experienced an HTML <APPLET> tag, this is a helpful

feature. It also enables you to test your application in your browser.

The wizard can generate sample animation images and code, as well as code

support for multithreaded applications. While this is not much beyond what is

provided with Sun's Java Developer Kit, I found the comments embedded around

this type of advanced feature to be very instructive. Having to remember the

code constructs for setting up threads and animation is a hassle, and this

feature saves you some time.

If your application requires support for mouse events (drag, move, enter,

exit, up, and down), the Applet Wizard can create the code for them as well.

These are among the most performance draining events you can include, so choose

them sparingly.

Finally, the AppletWizard provides support for parameters that you may wish

to pass to the application. For my tests, I made a server-side data file of

name and contact information, and I needed to specify the file name in the web

page. I could have hard-coded this name in the code, but I wanted to make my

test applet as reusable as possible. The parameter wizard supports specifying

the name of each parameter, the data type, default value, and the description.

This last element is useful in pages that are parameter-driven or for applets

that are nonvisual. Using a scripting language, the descriptive information

from the parameter list can be queried at run time by any external applet or

script. This self-documenting approach is further extended in the final page of

the Applet Wizard. This page lets you specify free-form textual information,

which can again be retrieved by any later user of your classes (applications)

at run time.

Do Your Own Thing

Once you have completed generating the applet starting code, you work with

the Developer Studio's class browser, code editor, and InfoViewer while you add

real functionality to your program. Depending on the path you took when you

specified whether an application could exist outside of a browser, you'll find

that you need to become familiar with the differences between applets and

applications. In brief, a Java application has a Main, or a standard entry

point (just like a good old C program). Additionally, the application

implements the runnable interface, and is responsible for creating its own

frame (the area where your user interface elements will reside). In contrast,

when you are working with an applet, the browser is responsible for creating

the work area.

When I first got a copy of Visual J++, my only exposure to Java had been a

few days spent browsing the JavaSoft web site (http://www.javasoft.sun.com). I

had also picked up a book on Java a few months beforehand, but hadn't gotten

around to actually doing any useful programming.

I approached Visual J++ with a determination to make a nontrivial

improvement to the web site I keep on my company's corporate intranet. I wanted

to make an applet that would access data that resides on the server, or better

yet would link my web site to my back-end databases via COM wrapper objects.

The splash screens that flashed by during the install all seemed to indicate

that this integration with Microsoft's data access and component strategies

would be possible.

Beta Blues

By the time you read this, Visual J++ will be in the retail channels. The

documentation that shipped with Beta 3 (the latest version at the time of this

review's deadline) indicated that integration with COM objects had been

achieved, and was illustrated in the sample programs. My InfoViewer (the

integrated documentation that comes with Developer Studio) showed pages for

sample programs, but I couldn't install the samples because I was unable to

locate them at the web site (they seem to require a CD-ROM). They may have been

there, but the Internet Builder area within the Microsoft site is a veritable

labyrinth of unlabeled graphic links. I had to settle for building an applet

that did server-side file references for my data link. Since I wanted to

simplify my group contact information list (a long scrolling region at the

bottom of my web site's home page), this was an acceptable alternative.

Another snag occurred when I tried to get the beta to install. This wasn't

the fault of any glitches in the installation program itself (which operates

quite smoothly), but is rooted in the latest atrocious marketing strategy to

come out of Redmond. Every one of the new Microsoft development tools (those in

the WebBuilder series) require either Windows 95 or Windows NT 4.0 on your

development machine. You are also required to have Internet Explorer 3.0 on

your workstation prior to being allowed to install Visual J++. So if you're

running a Windows NT 3.51 workstation like I was, you will either have to

upgrade to Windows NT 4.0 or downgrade your workstation to Windows 95.

Quantum Leap

While this may appear on the surface to be wholly a product of sneaky

marketing, there may be legitimate causes. If you have ever encountered the

debugger that ships with Sun's Java Developer Kit, you will be amazed that

Microsoft was successful in linking Visual J++ into the normal Developer Studio

integrated debugging environment. This is important because the dearth of good

Java debuggers has been a real problem in shops that are trying to build

complex applications with Java. The Java Developer Kit debugger pretty much

limits you to embedding a System.out.println interface. This is analogous to

embedded print statements, and really extends the time required for any serious

debugging session.

The Visual J++ debugger works interactively between the Internet Explorer

and the code editor that is built into Visual J++. This relationship between

the editor and the native browser becomes apparent the first time you set a

break point in your code. You can do this on virtually any line, in any class,

by right-clicking a source line with your mouse and adding a break point. If

you have the source for the Java base classes (Visual J++ ships with the

standard Java Developer Kit files in compiled form), you can even trace the

actions within those modules.

During a break mode, you have access to the stack and can examine the

contents of any variables or objects that are in scope, and you can step into

or over each method call. Microsoft has done a phenomenal job of making the

wholly object-oriented nature of Java easier to understand and learn via the

features of the debugger.

For example, when I was having difficulty opening the file that contains my

name and contact information, I was able to drill into the String object that I

populated via a call to the URL.toString() method. My task was to find the last

file separator slash in the URL, and I decided to parse it out with the

String.lastIndexOf() method. This combination yielded a count that was

significantly shorter than I expected. Using the debugger, I was able to

examine private variable values within the String object, and determine that I

should use the URL.toExternalForm() method instead.

World Classes

Creating a Java application differs from creating a C++ application mainly

in the requirement that Java code is totally object-oriented. This means that

to get anything done you have to create objects. In my sample application, I

wanted to hide the back-end data access method from my application. I didn't

want to have to make significant changes to the program when I would later move

the data into a relational database, so I made a data wrapper class that hid

the details of file access from the presentation layer of the program. Later,

I'll simply inherit the database class from this file access base, add in the

SQL or COM access methods, and recompile.

As you begin to build significant applications with Java, the number of

classes you deal with grows large, and the relationship between those classes

becomes increasingly complex. Visual J++ uses the class browser that is part of

the Developer Studio. This class browser presents a hierarchical view of the

classes that are part of your project. You can use this to quickly get around

your code because any time you double-click on a method or property shown in

the class browser window, the code where that element is declared comes into

focus in the editor window. Adding new classes, variables, or methods

automatically updates the class browser each time you either compile or save

your code.

Abstract Windowing Toolkit Support and Forms to Boot

The Abstract Windowing Toolkit is a platform-independent set of classes that

implement frames, buttons, fields, labels, and several other visual components.

Working with the Abstract Windowing Toolkit has always been a double-edged

sword. On one side, having access to these visual widget classes is a big plus.

On the other, having to handwrite code that places each component on a screen

requires pixel-by-pixel adjustment.

Visual J++ simplifies this by providing a Java Resource Wizard. This

extension of the IDE lets you use the standard dialog box editor that is part

of Developer Studio to lay out Java forms. The standard Windows dialog resource

that results is then translated into properly coded Java modules (one that

represents the form, and the other that manages the run-time behavior of the

form). This approach has the benefit of letting you not only construct user

interfaces in a simple drag-and-drop code window, but also to migrate your

existing Windows dialogs to Java. Support is even provided for importing form

layouts from Visual Basic programs.

High-Speed Development

Until I got Visual J++, my experience with Java applets had been limited to

those little animations that populate so many web pages. I admit that I passed

on the frenzy to download the free copy of Internet Explorer 3.0, and I've

always been sorely disappointed with the speed of Java applets. Even the

playing around I did with the official Java Developer Kit was tainted by

ponderous compile times and sluggish run-time speeds. That's all a thing of the

past with this release of Visual J++. Not only do you see an amazing run-time

speed boost due to the Just In Time compiler that is part of Internet Explorer

3.0, but the time to compile your code into the intermediate byte code form

taken by compiled Java programs is simply miraculous.

Early beta users of Visual J++ reported "unable to compile" errors that were

in fact due to the blinding speed of the development mode compiler. My test

program resides in four files, each with between 100 to 500 lines of code. To

build my program, the compiler needs to bring in large parts of the Java.Lang,

Java.IO, Java.UTL, and Java.AWT packages to complete my applet. Despite all of

this, the full compile time is less than three seconds. If I don't do a full

compile, and instead let the incremental compiler take care of only my changes

and then link the final byte code image, the job is complete before I take my

finger away from the mouse button. This blinding speed was the source of the

early (and mistaken) bug reports. It had worked. The significance? Turn around

times are cut way down. Given the time it takes to compile a Visual C++

program, I'm sorely tempted to do most of my coding in Java from now on.

Pros and Cons

PROS:

  1. Its high-speed compiler cuts the waiting time for large programs down to

    seconds.

  2. The full-featured debugger is tightly integrated with the Internet Explorer

    so you can step through your code and examine variables at run time.

  3. Extension classes that integrate with Relational Database Operator, Data

    Access Objects and COM objects will be provided as part of the retail package.

CONS:

  1. The Java class library documentation is well below normal Microsoft

    programming reference quality standards and doesn't cover sample code at all.

  2. The Abstract Windowing Toolkit classes haven't been augmented with any

    additional features.

  3. There is no tutorial on Java or the different components of the programs

    generated by the Java Applet Wizard.

Company Information

Visual J++ 1.0

Microsoft Corp.

Redmond, Wash.

Tel: (800) 426-9400

Fax: (206) 883-8101

Web:http://www.microsoft.com



Price: $99

Software Requirements: Windows 95 or Windows NT 4.0, Internet Explorer

3.0

Hardware Requirements: 75Mhz Pentium, 32MB RAM, 20MB disk space

Technical Support: (800) 936-3500 (standard and priority web

response)

Money Back Policy: 30 days

Competitors:

Sun's Java Workshop

Symantec Caf

Borland Latte


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.