Closing the Hood

Author Bids Farewell to Longtime Column

by Bill Venners
November 15, 1997

First published in JavaWorld, November 1997
Summary
This final installment of Under the Hood gives a brief history of the column, tracing its development and maturation, a topical index of the column's back issues, and a hint of what readers can look forward to from this popular JavaWorld author.

After one and a half years, the time has come for me to close the hood. This month's article represents the final installment of Under the Hood. I am saying farewell -- for a while.

How Under the Hood got started
For some reason, I tend to buy Economist magazines in airports. That's about the only time I buy them, and sitting on planes is about the only time I read them. Back in October 1995, as I was flying back to the Bay Area and thumbing through an Economist I had bought at the Denver airport, I came across a one-page article about a cool new programming language for the Internet. That is how I first heard about Java.

It's obvious that in those days I didn't have my finger squarely on the pulse of the Internet: Java had been out almost half a year before I even heard about it. At that time, I was busy working on software contracts, immersed primarily in the world of C++, MFC, and Microsoft Windows 3.1. When I first read about Java in the Economist, I was quite intrigued by it. As I read more about Java by surfing the Web, it became clear to me that Java would be my next step; it was the direction in which I wanted to go. I decided that after I completed the C++ project I was then working on, I would try to find a way to focus on Java.

One day in February 1996, as I was again surfing the Web looking for more information about Java, I came across a page that gave me an idea. A new Webzine named JavaWorld was about to be launched and was in need of authors. Having always harbored a secret desire to write novels, I thought to myself, "Self, this could be your big break." I figured I could get into Java, and get some writing experience to boot, by writing about Java. So I e-mailed Michael O'Connell, JavaWorld's editor-in-chief, and asked if a C++ person who is planning to learn Java could possibly write for his magazine. Michael said that providing we could find a suitable topic for me to write about, he'd be happy to give me a JavaWorld assignment.

My next problem, then, was figuring out what to write about. I kicked several ideas around in my head and bounced a few off of Michael. Eventually, he and I decided that I would write about the Java virtual machine (JVM), and the Under the Hood column was born.

I wanted to write about the Java virtual machine because I was interested in Java internals. Though it's a bit embarrassing to admit, my interest in Java internals wasn't some grand career strategy. It simply arose out of my own excitement about the technology. I thought Java was really cool, and I wanted to understand how it worked.

The origin of Inside the Java Virtual Machine
Although writing a monthly column presented quite a challenge for someone accustomed to writing software, before long I decided to go even further -- to take the big book-writing plunge. A literary agent looking for Java book authors read one of my JavaWorld articles, e-mailed me, and I ended up writing a book proposal. The proposal was accepted by McGraw-Hill, and I was then faced with the task of writing an entire book about the Java virtual machine.

The book, titled Inside the Java Virtual Machine, is currently in production at McGraw-Hill and should be available in December. This book is related to the Under the Hood column in both content and focus. It contains some material I originally wrote for the column, and the column contains some material I originally wrote for the book.

Why learn about the Java virtual machine?
The point of both the JavaWorld column and the book is to illuminate the technology that sits between you, the Java programmer, and the computer that runs your Java programs. One nice thing about the Java virtual machine is that, although it is complex, everyday Java programmers can understand it. In most cases, the Java virtual machine is, after all, just a program. With an understanding of the Java virtual machine, you can better understand the Java language itself, and most importantly, you can better understand how to put the Java language to use.

A great feature of an online magazine as opposed to a print magazine is that the back issues of an online magazine stay online. In JavaWorld, the back issues are as accessible as the current issue, being merely a click away. As a result, the Under the Hood column can be viewed as a unit, as an online Java internals resource. For descriptions and links to all the Under the Hood articles, see the next section of this article.

To view an online version of the book Inside the Java Virtual Machine, visit McGraw-Hill's Beta Books site. You may also wish to view an online copy of the Interactive illustrations Web Site, which is delivered on the CD-ROM that is included with the book. This Web site contains simulation applets that illustrate the concepts presented in the text of the book. (For links to the Beta Books site and the Interactive illustrations site, see Resources.)

Topical index of Under the Hood articles
Following is a list of all the Under the Hood articles, grouped chronologically, and, not surprisingly, by topic. The first three Under the Hood articles gave introductions to the virtual machine, the class file, and garbage collection.

  • The lean, mean virtual machine -- An introduction to the Java virtual machine. This article contains an applet, named Eternal Math, that simulates the Java virtual machine executing a sequence of bytecodes.
  • The Java class file lifestyle -- A look of the Java class file, the file format into which all Java programs are compiled. This article contains an applet, named Getting Loaded, that simulates a Java class file being loaded by a Java virtual machine.
  • Java's garbage-collected heap -- An overview of garbage collection in general and the garbage-collected heap of the Java virtual machine in particular. This article contains an applet, named Heap Of Fish, that demonstrates a mark and sweep garbage-collected heap.
The instruction set of the Java language
The bulk of the Under the Hood articles cover the JVM's instruction set. In addition to describing the opcodes and how they work, these articles use the instruction set to give insights into the Java language.
  • Bytecode basics -- Introduces the bytecodes of the Java virtual machine, and discusses primitive types, conversion operations, and stack operations in particular. This article contains an applet, called Conversion Diversion, that simulates a Java virtual machine executing a sequence of bytecodes that perform type conversion.
  • Floating-point arithmetic -- Describes the Java virtual machine's floating-point support and the bytecodes that perform floating-point operations. This article contains two applets. One applet, called Exposed Float, allows the reader to manipulate and observe a Java float. The other applet, Circle Of Squares, simulates the Java virtual machine executing a sequence of bytecodes that perform floating-point multiplication.
  • Logic and arithmetic -- Describes the Java virtual machine's support for logical and integer arithmetic, and the related bytecodes. This article contains two applets. One applet, called Exposed Int, allows the reader to manipulate and observe a Java int. The other applet, Logical Results, simulates the Java virtual machine executing a sequence of bytecodes that counts using only logical operations.
  • Objects and arrays -- Describes how the Java virtual machine deals with objects and arrays, and discusses the relevant bytecodes. This article contains an applet, called Three Dimensional Array, that simulates the Java virtual machine executing a sequence of bytecodes that initializes a three-dimensional Java array.
  • Exceptions -- Describes how the Java virtual machine deals with exceptions, and discusses the relevant bytecodes. This article contains an applet, called PlayBall, that simulates the Java virtual machine executing a sequence of bytecodes that shows exceptions being thrown and caught.
  • Try-finally -- Describes how the Java virtual machine implements try-finally clauses, and discusses the relevant bytecodes. This article contains an applet, called HopAround, that simulates the Java virtual machine executing a sequence of bytecodes that shows finally clauses in action.
  • Control flow -- Describes how the Java virtual machine implements control flow and discusses the relevant bytecodes. This article contains an applet, called SayingTomato. It simulates the Java virtual machine executing a sequence of bytecodes that shows a switch statement in action.
  • Method invocation and return -- Describes the four ways in which the Java virtual machine invokes methods, including the relevant bytecodes.
  • Thread synchronization -- Shows how thread synchronization works in the Java virtual machine. Discusses the bytecodes for entering and exiting monitors.
Marimba's Castanet and IBM's Aglets
Three times in the course of writing the Under the Hood articles I diverged from the Java virtual machine proper to cover applications of Java that I found interesting. Both of these applications, Marimba's Castanet and IBM's Aglets, take advantage of one of the aspects of the Java virtual machine's architecture that is important for everyday Java programmers to understand: class loaders.
  • Java beyond the browser: The Channel Metaphor -- This article (an extra one -- not actually part of the Under The Hood column) explains what Marimba's Castanet is and how it addresses some of the constraints presented by Java applets.
  • The architecture of aglets -- Describes the inner workings of aglets, IBM's autonomous Java-based software agent technology.
  • The point of aglets -- Analyzes the real-world utility of mobile agents such as aglets, IBM's autonomous Java-based software agent technology.
Coverage of the JVM's security model
The final four articles of Under the Hood give an overview of the security model built into the Java virtual machine's architecture.

What's next?
In a few months, I plan to begin another book project and related JavaWorld column. This time I'm going to focus on real-world programming techniques, with an emphasis on creating good designs. My working title for this project is Flexible Java: Java Design Guidelines and Idioms.

Over the years, I've worked with many languages and environments and with many programmers of varied backgrounds. I've been exposed to various methodologies and have put them into practice. I've done fresh designs. I've fixed bugs and made enhancements in existing code. Through reading books, talking with colleagues, and trying to get things to actually work, I've developed strategies and techniques that I rely on in everyday commercial programming practice.

With my next book, Flexible Java, I'd like to take what I know about Java, combine that with what I know about programming in general, and write a book that really gets to the heart of Java programming. I plan to write a practical guide to the successful use of Java in real-world, commercial environments.

As I write the book, I plan to publish the entire text of the work-in-progress on my own Web site so I can get feedback and participation from the Java community. The work-in-progress Web site will be posted at http://www.artima.com/flexiblejava/. In addition, in JavaWorld each month I plan to publish an article that is based on material from the book.

For a first look at Flexible Java's table of contents and my preliminary ideas for the upcoming column, visit http://www.artima.com/flexiblejava/.

A thank you
I want to say thanks to the readers of my Under the Hood articles. I hope you found them useful.

Thanks especially to those who submitted feedback, either through e-mail or through the comment boxes at the bottom of each JavaWorld article. The feedback, especially criticism, was very helpful.

In my next writing project, I hope to increase my interaction with readers, so please feel free to send in those comments. To start with, I welcome comments on my Flexible Java book and column proposal, which you can find at http://www.artima.com/flexiblejava/.

I expect to start the new JavaWorld column in a few months. Until then, have fun programming in Java, but don't work too much. Life is short.

Resources

This article was first published under the name Closing the Hood in JavaWorld, a division of Web Publishing, Inc., November 1997.

Talk back!

Have an opinion? Be the first to post a comment about this article.

About the author

Bill Venners has been writing software professionally for 12 years. Based in Silicon Valley, he provides software consulting and training services under the name Artima Software Company. Over the years he has developed software for the consumer electronics, education, semiconductor, and life insurance industries. He has programmed in many languages on many platforms: assembly language on various microprocessors, C on Unix, C++ on Windows, Java on the Web. He is author of the book: Inside the Java Virtual Machine, published by McGraw-Hill.