The Hello World Applet in Java™ 1.5: A Software Time and Motion Experiment
by Van Warren MS CS, AE © 2005

Abstract
This experiment applies Taylor's method of Time and Motion study to the software engineering problem of the "Hello World" Java™ applet . Tasks were divided into two categories, system preparation, and applet development. Preparing a typical stock system for Java™ development required 4.1 hours and 38 user context switches. Developing a "Hello World" applet, with a standard form design required 10.1 minutes and 92 context switches. A productivity metric that emerges is context switching rate. From the data measured the fastest context switching rate observed was 3 per second during the applet-form preview task.

Introduction
This experiment is dedicated to the Sun Development group who labored to bring us Java™. Ten years ago, in the mid-nineties heyday surrounding the rapid growth of the world wide web, Java™ was released by Sun Microsystems™. At that time, the browser-borne applet became the primary vehicle for creating interactive web experiences. After the dot com crash and ensuing world events, some uncertainty surrounded the direction that web-based computing would take. Several competing methods arose, including Macromedia Flash™, ShockWave™, and more recently Processing™. Early on, Microsoft™ tried to get in the game by releasing their easy-to-use J++ interactive development environment (IDE) but that was not to be. Later NetBeans emerged as a flagship IDE. Out of this period arose several principles of open and fair computing. These included traditional principles of hardware independence and newer ones of browser independence and open source. Meanwhile the computing economy is transforming itself into a service-based enterprise where large portions of critical software capability are becoming free with no end to this trend in sight.

During this period, my partner and I decided that it was important to protect ourselves from the winds of frequent technical change. We coined the phase, "Dual browser, dual platform." as a label for the future development strategy. The goal was to move future application development completely to the web as the end-all destination for machine independent applications. The aim was to avoid subversion by single monopolistic interests and encourage collaboration. It was influenced by the desire to embrace various cultures, especially those featuring vinyl disks or chrome wheels which run briefly backwards.As an evolving open standard, Java™ was no exception. It ran on multiple machines including, "Wintel", Macintosh™, and Sun Workstations. Java™ ran on browsers including Netscape Navigator™, Internet Explorer™ and more recently Mozilla Firefox™.

The following study examines the process of creating and deploying a "Hello World" applet in Java™ version 1.5 update.3. The objective is to apply Frederick Taylor's concept of "time and motion studies" to a simple software engineering task. The open source tool NetBeans™ is used as the IDE. Because of the large memory footprint of NetBeans™ the time and motion required to bring the user's environment into compliance is included in the experiment.

My hypothesis is that the fewer context switches required of the user for a given task, the greater their productivity will be. The measure of productivity is the time that it takes to prepare the system and the time it takes to produce the "Hello World" applet. Smaller elapsed times for system preparation and applet development indicate higher productivity.

Definitions and Method
Times are measured to the nearest second. Motion is measured in "context switches". A context switch is a change in activity type, typically manifested by the need to look at a different window, to approve or cancel an action, or to consider a different solution. A context switch implies using a different part of the brain or a different neurological pathway. A context switch represents a change from "what" to "how". That is "what we were working on" versus, "how are we going to approach this". In the case of memory-intensive tasks it is "what were we doing?". Psychophysics tells us that navigation and reflection take place in different parts of the brain. The sense is that successful systems leave the user concerned with "what" they are doing, more than "how" they are going to do it. A successful system should enable navigation to quickly become subconscious, like driving. Times and context switches are reported in the right column of each panel below. The average time and cost of a context switch is included for each category of activities.

The following steps in building and deploying a "Hello World" applet are documented below. Your times may vary. How long it takes you depends on your background, connection speed, system and level of distraction. To repeat this experiment exactly, click on the links or images below and use a stopwatch. I used Morimoto's ten-track timer. Specific locations are listed in the "Wintel" environment, but the idea is the same for other platforms. The table of times and context switches is included at the end in the results section. So let's begin.

System Preparation - Memory Upgrade

The project was executed on a 1.7 GHz Sony Vaio laptop with 255 Mb of RAM running Windows2000 operating system. If you have less than half a Gigabyte of RAM plan to order more memory. Java™ and NetBeans™ won't work without it.

 

Low memory machines endlessly churn between paging and garbage collection resulting in wasted time.

The NetBeans™ Interactive Development Environment (IDE) is not happy on a machine with less than 512 Megabytes of RAM

Also make sure you have 500 Megabytes of free disk space before installing Java.
Java™ is a pig for RAM and disk. Just accept that and feed the beast. It will save you hours in the long run.

 

 

 

.

 

Upgrading memory required 3 hours and

6 context switches.

This required:

a) exiting NetBeans™
b) shutting down
c) going to the store
d) coming back
e) starting up
f) restarting NetBeans™

 

System Preparation - Download and Install Firefox™

Download and install the latest version of Firefox™. This tutorial will work without Firefox™, but it will be slower and machine dependent.

Downloading and installing Firefox™ took 3 minutes 5 seconds and

4 context switches.

This required:

a) clicking on a link
b) waiting
c) installing Firefox™
d) starting Firefox™

System Preparation - Download and Install Java™ SDK and NetBeans™ Bundle

Download and install the latest Java™ and NetBeans™ bundle. Leave your existing installation alone.

Downloading bundle took 27 minutes 22 seconds.

Installing bundle took 15 minutes 39 seconds.

Total time this step:
43 minutes 1 second and

5 context switches.

This required:

a) clicking on a link
b) waiting for download
c) downloading bundle
d) clicking on installer
e) following instructions

 

System Preparation - Download and Install Java™ Runtime Environment - JRE

Download and install the latest Java™ Runtime Environment

Test that Firefox™ works on example Java™ applets by clicking here.

Downloading JRE took 3 minutes 55 seconds.

Installing JRE took 3 minutes 0 seconds.

Total time this step:
6 minutes 55 seconds

and 3 context switches.

This required:

a) clicking on a link
b) waiting
c) installing JRE

System Preparation - Firefox™ Java Compatibility

If Firefox™ does not work on the test Java™ applets, get advice by clicking here. Firefox™ only likes one virtual machine at a time. Thus, there should only be one NPJPIxxxxxx.dll files in the plugins directory. If you find extra NPJPIxxxxx.dll files, quarantine them. Many people have had problems because of this.

Understanding what was wrong took over a day.

Checking this issue once understood took 17 seconds and

3 context switches.

This required:

a) opening folder
b) quarantining .dll files
c) closing folder

System Preparation - Download and Install Java™ Documentation

Download and install the Java™ documentation from here.

Install the documentation in the proper directory as shown.

Your installation may differ slightly. Do not unzip the file. NetBeans™ takes care of that, using the zip file as is.

Download of docs took 11 minutes 16 seconds.

Install of docs took 38 seconds.

Total time this step:
11 minutes 54 seconds and

5 context switches.

This required:

a) clicking on a link
b) waiting for download
c) downloading bundle
d) clicking on installer
e) following instructions

System Preparation - Installing the Java™docs in NetBeans

Java™ is well documented and that documentation can be accessed quickly if NetBeans™ knows the location of the .zip file we downloaded above. This location is specified by the menu Tools --> Java™ Platform Manager:

Note that the mouse is pointing at the Java™doc file at the THIRD tab.
This tab specifies where the zip folder is added.

This step took 38 seconds and and

6 context switches

This required:

a) Selecting Menu Item
b) Selecting Tab
c) Selecting Add Zip Button
d) Searching for Zip File
e) Clicking Add Zip File
f) Clicking Close Button

System Preparation - Configure NetBeans Memory Usage

Edit the NetBeans™ startup configuration file and add a new line that allows NetBeans™ more memory.
Change just the highlighted portion of the line shown. Comment out the old line.

 

Configuring NetBeans™ memory took 46 seconds

and 3 context switches.

This required:

a) opening file
b) editing file
c) closing file

System Preparation - Test NetBeans™

Test NetBeans™ installation by clicking the icon that appears on the desktop.

If the program starts up without incident you have succeeded. Shut it down.

Testing NetBeans™ took
1 minute 30 seconds the first time.

Testing NetBeans™ took 28 seconds to open on subsequent trials.

3 context switches.

This required:

a) opening NetBeans
b) testing a menu
c) closing NetBeans

User Preparation - Take This Break - Skim Three Pages

Skim pages 18 through 20 of the NetBeans™ IDE Field Guide excerpted here.
Focus on the section entitled Creating and Deploying Applets. It will save you hours of distress.
User Preparation Times will not be included in the totals. Although useful, it is beyond the scope of this study.
It would make an extremely useful follow on since the time to train a Java developer is the gating factor in technical progress.

.

Reading and understanding this took 4 minutes 11 seconds and

3 context switches.

This required:

a) opening Field Guide
b) reading Field Guide
c) closing Field Guide

Development - Warming Up Before the Big Event

Now we'll follow the steps and create a real applet.
Prior to this we have a few necessary warm-ups to do. The order is:

  • Get a trivial applet running.
  • Make that applet say, "Hello World".
  • Look at the source code.
  • Install the documentation library we downloaded above.
  • Show off a couple of key features that enable development.
  • Show the escalating Edit-Compile-Look Cycle that enables development, testing and deployment.
 

Development - Open NetBeans™

Test NetBeans™ installation by clicking the icon that appears on the desktop.

Opening NetBeans™ took 24 seconds and

1 context switch.

This required:

a) opening NetBeans

Development - Creating the Applet Project

In NetBeans™ we click the File --> New Project menu to obtain:

We then click Next > to obtain:

Creating Applet Project took 19 seconds and

3 context switches.

This required:

a) Select Java Class
b) Entering Name/Location
c) Clicking Finish

Development - Open Applet Packages

These actions produce the following outcome in NetBeans™.
The applet project is really a library project we will call Wave.
We could have called it, "Hello World", but Wave is the name of the old applet
we are going to convert after we get "Hello World" working.

Opening the packages took 6 seconds and

1 context switch.

This required:

a) opening 4 packages

Development - Create Applet Form

Now we produce a simple test applet. Right click the Wave Project and create a JApplet Form. JApplets are from the Sun Swing package and have more up to date extensibility than Applets from the older awt package.

 

Creating the JApplet Form took 21 seconds and

3 context switches

This required:

a) selecting JApplet Form
b) naming the JApplet
c) clicking Finish

Development - Observe Form Design and Source Code

Now everything comes alive. You might want to get all excited.

Notice that Wave.Java™ is in a subpackage named myWavePackage.
To quote Jack Black, "Java™ Daddy like".
See the memory indicator in the upper right corner? You want to keep an eye on that.
It will tell you when Java™ wants a coffee break to garbage collect.

Opening Wave.Java™ in Form Design mode took 12 seconds and

2 context switches

This required:

a) observing Form Design
b) observing Memory Tool

Development - Build Trivial Applet

It is a good idea to always test everything."In software engineering positive and negative controls are your best friend." I stole this saying from my friend Barry Hurlburt who does science. The idea is the same. Before continuing we ask NetBeans™ to build the project using menu: Build --> Build Main Project. This compiles the sources, creates the jar files and works a number of minor miracles, some of which we need to know about. The function key F11 does this for free in the Kris Kristofferson Bobby McGhee nothing left to lose sense.

The first minor miracle: NetBeans™ reminds us we need to set which project we are currently working on:

The first build took 11 seconds.

Subsequent builds took 8 seconds and

3 context switches

This required:

a) Selecting Build Item
b) Setting Main Project
c) Clicking OK

Development - Savor First Build

The build is successful.

Savoring our success takes 5 seconds and

1 context switches

This required:

a) Savoring Build

Development - Run Build in Applet Viewer

Now we can run the build:

The second minor miracle: NetBeans™ runs the applet in a special applet viewer.

The result is trivial since we haven't equipped the jApplet to do anything. But it works.

Running the build in the applet viewer took 3 seconds and

4 context switches

This required:

a) Selecting Run Item
b) Waiting for Applet
c) Evaluating Applet
d) Terminating Applet

Development - Add "Hello World" JLabel to Applet

Returning to the visual editor, we can toggle between the form designer view and the source code view. To make the applet say, "Hello World", we first click on the JLabel button in the Swing Palette as shown. We then click on the form to instance the label.

Creating the label took 10 seconds and

2 context switches

This required:

a) Selecting Swing Label
b) Instancing Label

Development - Changing the Applet Layout

To get the label to behave predictably, we choose a different layout:

Changing the layout took 7 seconds and

1 context switch

This required:

a) Selecting New Layout

Development - Sizing and Placing the Applet Label

Then the label can be sized and placed appropriately.

The different layout options were designed with good intentions - those of being able to adapt to unknown layout circumstances. This generality has not worked out well for designers who just want to, "put that there", which is the proper role for humans in the design loop. Absolute layout is a step in the right direction.

 

Sizing and placing the label took 26 seconds and

3 context switches

This required:

a) Selecting Label
b) Sizing Label
c) Placing Label

Development - Changing Label Value and Alignment

We can change the label's value to, "Hello World" and the horizontalAlignment to CENTER.

Changing the label's value took 19 seconds and

3 context switches

This required:

a) Selecting Label
b) Changing Label Value
c) Changing Label Align

Development - Refer to Documentation

We can quickly access the documentation by RIGHT-CLICKING the mouse after selecting a code fragment.
There are other goodies on the right-click menu that save time.
I use the Reformat option often. Refactor is very useful too.
It keeps you from breaking programs that work when you want to move code and files around.
Java™ is picky about that.

The requested documentation now appears in our companion Firefox™ browser.
Note that Java™ 1.5 and Java™ 2 Platform SE 5.0 are the same.
Isn't that confusing? I wonder who came up with that idea.
On a bad day, I could have. I'm always renaming my variables looking for the ultimate meaning.

This step took less than 24 seconds and

4 context switches

This required:

a) Selecting Menu Item
b) Waiting for Browser
c) Reviewing Document
d) Returning to NetBeans

Development - Establishing The Edit-Compile-Look (ECL) Testing Cycle

In the sections that follow, we will test and deploy our trivial "Hello World" applet in escalating steps.
Then we will convert the old applet code to fit within the new applets framework.

The idea is to catch errors as quickly as possible.

The steps for applet testing and deployment are:

 

Development - Testing the Applet Form

There is a button in the form design tray that executes a consistency test on the form itself.

Sometimes the test form is scrunched up, but still works. Resize the form to make sure it is working.

This step took less than 1.0 seconds and

3 context switches

This required:

a) Selecting Test Button
b) Waiting for Window
c) Terminating Window

Development - Build, Run and View the Applet in Applet Viewer

Pressing the F11 key to build and then Shift + F6 to run yields:

Building and running in succession took 22 seconds and

6 context switches

This required:

a) Pressing Build Key
b) Waiting
c) Pressing Run Key
d) Waiting
e) Evaluating Applet
f) Terminating

Subsequent Build and Runs

This is the second test in our escalating ECL test cycle.
As before, we build with F11, then run with Shift + F6:

This step took
3.5 seconds
and

4 context switches

This required:

a) Pressing Build Key
b) Pressing Run Key
c) Evaluating Applet
d) Terminating Applet

Development - Testing the Applet with Codebase HTML File

NetBeans™ produces an HTML file with an applet tag that includes a full codebase qualification.
We will soon replace this full codebase with a Jar file, but one step at a time:

Double clicking on the html file in NetBeans™ opens it in the source editor:

This step took
18 seconds and

3 context switches

This required:

a) Find HTML File
b) Open HTML File
c) Evaluate HTML File

Development - Saving HTML File

There are three views of a given project, File, Project, and Runtime.
These views are accessed by clicking the tabs in the upper left hand corner of NetBeans™.
Clicking on the File tab and opening the build folder reveals a third minor miracle
that took place when you hit F11 to build the applet.

A local HTML file has been created for running the applet.

The trouble with the current location of this HTML file is that it will be recreated every time a "Clean and Build" is done.
To prevent this, copy the file back to the src directory like so:


build/Wave.html will now recreated with each build from src/Wave.html

In other words, the Wave.html file in our src directory will now be swept forward to the build directory each time we press F11.

Now we have established the repeating component of our design cycle:

  • Edit src/Wave.html
  • Build by pressing F11
  • View build/ html
This step took
18 seconds and

4 context switches

This required:

a) Find build HTML File
b) Copy HTML File
c) Find HTML destination
d) Paste HTML File

Development - Testing Applet with HTML File + JAR File

As your application become more sophisticated you will have several files, one for each class or object in your project
Another minor miracle that NetBeans™ does is that it packs all your classes into a single file Java™ ARchive file or JAR file.
This is handy for deploying the applet to a web site.

It also removes the longish filename path dependence we saw above.
To use the JAR file, we duplicate our src/Wave.html file and call it src/Wave2.html.
We then open src/Wave2.html and change the Applet line to read as follow:

When we build, our changes get saved automatically. This is a nice feature if you wanted those changes.

You can usually click undo after the build if you didn't like what you got.

Changing from an absolute codebase to a jar file took 43 seconds and

2 context switches

This required:

a) Return to HTML File
b) Edit HTML File

Deploying Applets that Use Absolute Layouts

We are almost ready, but now we have to run one of those strange senseless stone-age errands. We have to include the class files for absolute layout with our build in order for our deployed HTML applet files to work. For some good historical reason, this turns out to be a time wasting hassle. Let me spare you the details and give you just enough to known the pain without feeling it. Figuring out what was actually wrong and what to do about it took four hours. I can shave that to 4 minutes and 19 seconds. The fix is covered in Appendix 1

.

It takes 4 minutes and 19 seconds to implement the absolute layout fix and
required 23 context switches. See Appendix 1.

Development - Test Final Local Applet

Finally! We are ready to run the local html file. Remember this right click viewing trick. We will use it often.

This produces the following result:


Sometimes the browser will cache the applet, and recent changes will not show up.
For best results, kill the browser each time, and force NetBeans™ to restart it.
This is another reason to use Firefox™. It starts fast.

This step took
2.1 seconds and

5 context switches

This required:

a) Select View Menu Item
b) Wait for Browser
c) Evaluate Applet
d) Terminate Browser
e) Return to NetBeans™

Development - Exit NetBeans

We are almost ready to deploy the applet to our server and test it remotely. Since NetBeans™ locks the jar file from other applications, we have to Exit NetBeans™ to release the lock. Simply closing the project will not work.

 

This step took
7.2 seconds and

2 context switches

This required:

a) Exit NetBeans™
b) Wait for Final Write

Development - Upload the Applet Files to Server

This step took
24.6 seconds and

4 context switches

This required:

a) Open FTP Application
b) Select Files
c) Select Upload Button
d) Wait for Upload

Development - Test the Deployed Applet

It works!

This step took
18.0 seconds and

5 context switches

This required:

a) Open Browser
b) Navigate to Site
c) Wait for Download
d) Evaluate Applet
e) Terminate Browser

This is the end of the experiment. Results are summarized below  

Results


Conclusion

At the outset I believed that accomplishing the most development operations in the lowest number of context switches was the best metric for software productivity. It now appears that the context switching rate itself is useful for measuring productivity. It is clear that the user is capable of switching contexts far more rapidly than the current generation of machines and IDE's. Two categories of tasks were studied, System Preparation and Applet Development. An additional critical category of task emerged and that is User Preparation. User Preparation was left out of this experiment completely. Here is its relevance. A user who does not know what to do next is stuck until they figure that out. This can take seconds, minutes, hours, days, months, years or never. A user who knows what to do next is the most important single factor in productivity. This factor was not measured at all in this study, but will be addressed in further time and motion experiments dealing with applet conversion.

By measurement the fastest context switching rate observed was 3.0 per second. The actual figure is probably larger, if "Kell Factor" is the gating issue. "Kell Factor", a term borrowed from video engineering, is taken to mean the time that it takes for a user to perceive that a change has taken place in the system and respond accordingly.

Eventually it would be desirable to identify and rank the cost of a context switch by type. Knowing this will enable us to streamline the development cycle and improve the rate and ease of software development.

 

Useful References

Getting past Hello World is beyond the scope of this experiment, but you may find the following references excellent starting points.


Acknowledgements

The ongoing support of my family and technical colleaguee Marilyn Fulper are gratefully acknowledged.
Thanks to Dr. Barry Hurlburt for helping me cultivate a genomic view of computer science.
Gratitude and appreciation are expressed to the NetBeans Development Team.

 
Last updated May 29, 2005