Sun and Oracle Community Voices How to Buy Log In United States [Change] English

»  Contrarian Minds Archive
Contrarian Minds: Ken Russell
Plug in Now

Reimagining Java in the Browser

Story by Al Riske. Photography by Howard Friedenberg.

August 11, 2008 - The way Ken Russell sees it, it was his karma to make Java technology run faster.

It started in the Media Lab at MIT a decade ago, when Russell was working toward his master's degree.

"Our advisor came to us and said, 'Okay, guys we're doing super-intelligent animated characters and we're doing them in Java,' and I said, 'No, it will be too slow!'" Russell recalls. "So it's been my karma over the past 10 or so years to make that not the case in the 3-D graphics realm."

Russell, now a senior staff engineer at Sun, notes that speed is no longer an issue. "At this point, we can do faster 3-D graphics in Java than we can in C++ due to the hard work of everyone in the Java software organization," he says.

But that's only a preamble.

The central story here is how Russell and his team have been able to make Java software run more reliably in Web browsers and, in the process, taught it to do new tricks.

"Ken has an innate ability to recognize opportunities for innovation, that hugely valuable trait of not taking no for an answer and be willing to disregard the commonly accepted state typically expressed as 'That's just the way we have always done it.'"

Bob Brewin
CTO of Software
Sun Microsystems

 

In the course of just one year, Russell and a handful of his colleagues reimagined and redesigned the Java plug-in – the code that goes into Web browsers so they can launch and run Java applications.

"The inspiration? It was an ongoing thing where it was painful, painful, painful, and it was obvious at a certain point what had to be done," Russell says.

Ken Russell
"Java can run both in and out of the browser, and if you deploy your Java application outside the browser using Java Web Start technology, it's really reliable, really robust. But if you tried to write the same kind of program and put it into the Web browser on a Web page, then you were faced with certain limitations."

Fortunately he saw those limitations as merely technical. All one had to do, really, was read through about 50,000 lines of code, digest it all, distill it, and then start writing again from the beginning.

Oh, and make sure all the Java applets already out there on the Web still run unchanged.

Piece of cake, right?

"The code to the previous Java plug-in was fairly disorganized because it had grown organically over a number of years, and it was done in a big rush when it was first conceived," Russell observes. "There had never been the opportunity to go back and rewrite the whole thing."

Quite frankly, he says, the architecture was exactly inverted from where it needed to be.

"Ken realized that not only was the current architecture fundamentally flawed but that by changing the model, we could break free from the burden of a fragile and universally panned plug-in architecture," says Bob Brewin, CTO of Software at Sun. "By leveraging this new and innovative design, Java could once again take center stage on the Web as the new plug-in would not only allow for transparent execution within and outside the browser but revolutionize the concept of deployment of applications via the Web."

"The project was really motivated by wanting to do more advanced Java programs in the Web browser."

Ken Russell
Senior Staff Engineer
Sun Microsystems

 

There were, Russell says, "some fairly large unknowns."

One of the biggest was whether technology similar to Java Web Start would work in all browsers running on all operating systems. For Solaris and Linux, probably yes, since a similar technique was already in use (though it would need to be made much more robust to support the use cases Russell had in mind).

The big unknown was the Microsoft Windows platform.

"We had to do a significant amount of prototyping before we could even test the viability of the project in some ways. We had to build enough software to do some tests to see: Is it going to work? Yes or no?" Russell says.

"That was a major hurdle because it's difficult for people to buy into a project until they see results on the screen, but we couldn't show results on the screen until we built a significant amount of the project."

Fortunately, the project had the support of Software CTO Bob Brewin and Sun Fellow James Gosling (a.k.a. the father of Java) right from the start.

"That was Step Zero," Russell says. "That was absolutely necessary to get alignment and enough support to begin to drive the project forward."

"Ken realized that not only was the current architecture fundamentally flawed but that by changing the model, we could break free from the burden of a fragile and universally panned plug-in architecture. "

Bob Brewin
CTO of Software
Sun Microsystems

 

Ken Russell
Initially working on borrowed time, Russell wanted to get something on screen as quickly as possible.

"If you want to run your applet, you need the applet container in order to load it, start it, and give it enough services so that it can feel it's in the environment it expects. So the first step was rebuilding the applet container out of the pieces that were in the old applet container," he says.

"It was really picking out exactly the chunks of source code, rewriting some of them, and then putting them in the right places, so that we had an applet container that would run applets completely independently of the Web browser."

That took a long time.

"It took months because it wasn't the top priority project all the time, and it took a long time to go through that much source code and see where all the relevant pieces were because they were scattered throughout many files," he says. "But you needed this piece from here, this piece from here, and this piece from there, so you really had to read all of it."

"It's difficult for people to buy into a project until they see results on the screen, but we couldn't show results on the screen until we built a significant amount of the project. "

Ken Russell
Senior Staff Engineer
Sun Microsystems

 

Then came an intense, highly focused, no-distractions effort that Russell describes as a marathon/sprint.

"Starting from the stand-alone applet version, we were able to get that hooked into the Internet Explorer browser in nine and a half days," he says.

How were they able to do it so quickly?

"Web browsers are typically written in C or C++, so in order to hook into it you have to write some C or C++ code. The old Java plug-in had a lot of C and C++ code and even the Java code was mainly browser specific. In the new Java plug-in, most of this software is written in the Java language and there's the tiniest bit of C and C++ to glue it into the browser," Russell explains.

"So we go from C and C++ into Java as quickly as possible even on the browser side, and from there we go to platform-independent Java as quickly as possible – and from there most of the system is completely platform and browser independent. That's one of the key innovations here."

The main reason the team succeeded, he says, is Java itself.

"We used the advantages of the portable Java language with its much simpler semantics and syntax and powerful things like multithreading support built into the language to be able to construct this system rapidly -- and reliably."

"As it turns out there are some very interesting opportunities that became obvious to us by doing this architectural change. "

Ken Russell
Senior Staff Engineer
Sun Microsystems

 

Originally undertaken in support of Sun's Java OpenGL project, or JOGL, the new plug-in is also the underpinning of the JavaFX deployment strategy in the browser.

"JavaFX will rely on a very sophisticated set of libraries to extend the functionality of the Java platform to get the performance and features we need to do rich media content in the browser. So we needed a technology like this that was on par with Java Web Start technology to be able to get these new features of the Java platform down to the end user's machine and run them inside the Web browser," Russell says

"As it turns out there are some very interesting opportunities that became obvious to us by doing this architectural change."

He turns to his computer and brings up a JavaFX applet in his browser.

Ken Russell
"This is a buddy list. It shows you pictures of your friends, what the weather is like where they are, what time zone they're in, and you can even see where they are because if you click on a name it starts the NASA World Wind Java viewer, which is fully running here. You can zoom in and out. This is great because it shows a mix of JavaFX and existing Java components, together as an applet on a Web page," Russell says. "But you might say, 'Hey, I want to use this buddy list more often than just when I'm on this particular Web page.'"

Then he demonstrated an interesting new feature of the Java plug-in. He drags the applet from his browser to his desktop. Even when he quits the browser, the applet keeps running.

"That was enabled by the architectural changes we made," he says. "Of course we have to do more work. There are some rough edges in the new system, but in terms of achieving a goal that isn't possible with any other Web technology at the moment, I think we did pretty well."

Russell credits his colleagues in the software group as well as early access customers and partners for helping refine the new plug-in, and his manager, Gustavo Galimberti, for supporting the project.

"Now we maintain all this code and have the ability to extend it in some very interesting ways. We're looking forward to really taking advantage of that as we push forward."


Ken Russell

Title: Senior Staff Engineer, Software, Sun Microsystems.

Education: Bachelor's and master's degrees in computer science/electrical engineering from the Massachusetts Institute of Technology.

Background: Joined Sun in 1999, right after earning his master's degree from MIT.

Quote: "In terms of achieving a goal that isn't possible with any other Web technology at the moment, I think we did pretty well."

What Others Say: "Ken has an innate ability to recognize opportunities for innovation, that hugely valuable trait of not taking no for an answer and being willing to disregard the commonly accepted state typically expressed as 'That's just the way we have always done it.'" - Bob Brewin, CTO, Software, Sun Microsystems

Patents: Several pending.

Hobbies: Running and rock climbing.

Last Book Read: Practical Vedanta: Selected Works of Swami Rama Tirtha.

Favorite Food: Tofu. ("It's amazing what they can do with it.")

Favorite Movie: The Matrix.

Favorite Song: "St. Elmo's Fire," by John Parr.

Pet Peeve: Obstructionist management.

Childhood Ambition: Computer programmer.

First Job: Setting up computer terminals for a Wall Street firm at age 18.

Favorite Destination: Home in New York City.

Perfect Day: Having no meetings and fixing a really thorny bug.

Proudest Moment: Graduating from MIT with his parents present.

What Brought Him to Sun: Java.

What's Next: JavaFX and extending the Java plug-in.