Sun Java Solaris Communities My SDN Account Join SDN
 
Community

Meet Shannon Hickey, Technical Lead for the Swing Toolkit Team at Sun Microsystems

 
 
By Janice J. Heiss, September 2006  
Shannon Hickey Bio: I am the technical lead for the Swing toolkit team at Sun Microsystems, where I've worked since 2000. I began as a junior engineer working on the Swing toolkit in Santa Clara, California, where I had a chance to gain a deep knowledge of Swing and a broad knowledge of the Java programming language. Since 2004, I have passionately worked with the Swing toolkit to enhance the drag-and-drop experience. I now live in Canada with my family and have twin boys who keep me very busy.

java.sun.com (JSC): Tell us about your enthusiasm for drag and drop.

Hickey: I remember meeting with a customer who was trying to figure out how to make his company's application work better in relation to drag and drop. He kept asking, "Can I do this? Can I do that?" And I kept saying, "No." I realized that Swing drag and drop was not what it should be, so I made it my mission to fix it. Now, almost everything customers have asked for is available in Java Platform, Standard Edition 6 (Java SE 6).

 

JSC: What's the biggest misconception about the Swing toolkit?

Hickey: I've been hearing for years that Swing is slow -- I think that's just plain false. You can write a slow application in just about any toolkit. Swing is very powerful, so it's possible to get lost. But you can write first-rate Swing applications that are very quick and perform well. For example, you can create animations that fade in and out. You can't do that on a lot of native toolkits. Swing allows you to do this fast. Even in Java 2 Platform, Standard Edition 5.0 (J2SE 5.0) and J2SE 1.4.2, you can create such animations.

Writing Code

JSC: Can you describe the process of writing code?

Hickey: I tend to have a lot of energy, so if I'm really excited about solving a problem, the first thing I do is quickly throw together methods and prototype it until I get the right bits on the screen or the right behavior. That's my proof of concept. It might take an afternoon or a couple of hours.

But once I've proved that it works, I start thinking about how to properly design the API. Working on a toolkit team, or anywhere in Sun, we're writing code for others to use, so we have to think about creating the right API. Once we have committed to it, we can never pull it from the JDK. So we design it with developers in mind. There's a big difference between making it work really quickly for me and actually designing it flexibly. There's a lot to consider.

When I'm prototyping functionality for large projects, I often take a step-by-step approach, writing small pieces and then building on top of them. For example, let's say I want to write a drag-and-drop application that allows you to drag an icon around on the screen. I first put together the drag-and-drop support that moves bogus objects. Then I see if I can drag a specific icon such as a red rectangle around the screen. Next, I see if I can get an image to move around the screen. Then I write the code that generates the image. I find the process quite exciting, and I'm always eager to get to the next piece of the puzzle!

JSC: Where in programming do you have the most fun?

Hickey: A lot of what I do is fun because I see instant results on the screen. When I fix a button to make it look more like Microsoft Windows or the GIMP Toolkit (GTK+), I see it instantly. I don't have to write a lot of test cases to sort data and make sure they print out correctly. The fun part is in the proof of concept. Sometimes in the middle of the night or in my morning shower, I'll get an idea. I used to have to wait 45 minutes to commute to the office, but now, working at home, I can run into my office and write it down or type in my ideas.

JSC: Does an idea always work when you have these inspirations?

Hickey: No, sometimes I have to revise it. It always gets me energized and ready to dive in. But sometimes the inspiration leads to new hurdles. So I go back to the mental drawing board and head down the hall to bed, to brush my teeth, or to play with my kids -- waiting for the next idea.

A Compatibility API

JSC: If you could work on a dream project, what would it be?

Hickey: As an engineer, I'd love to be able to clean up old and unused parts of the Swing toolkit and the Java programming language without having to worry about backward compatibility. It's just a dream though, because compatibility is very important to our customers and is something we take seriously. For instance, every time I fix a bug, even if I'm correcting completely wrong behavior, I must be careful not to break something for someone who is relying on that wrong behavior.

For example, I modified JTable a while back to ensure that the focused row was set to the first row whenever the table gained its first data and was then set back to -1 when the table became empty. The goal was to ensure that tables showed focus whenever possible but to correctly use -1 if they are empty. This solved numerous open bugs.

Unfortunately, within a couple of weeks, two bugs were filed against my change. It turned out that modifying the focused row fired events, and some existing client code wasn't prepared to deal with these events. Although I strongly want code to "do the right thing," I understood that we must try not to break existing code. Unfortunately, I had to pull this perfectly good code in favor of something less optimal. Now, the focused row always stays at -1, until either the developer or the user changes the selection. The funny thing is, I've seen bugs filed on this behavior since.

The Swing toolkit team is considering creating a compatibility API to deal with issues of backward compatibility. Such an API would offer the "latest and greatest" to developers who are less concerned with backward compatibility, such as developers writing new applications or those new to the platform. The compatibility API would enable me to protect fixes like the one in which I modified the JTable, but they would only be enabled if the developer requested a certain compatibility level.

JSC: When will the compatibility API be ready?

Hickey: I think with Java Platform, Standard Edition 7 (Java SE 7). To date, we've added properties to turn on pieces of behavior. But the compatibility API we are considering would allow the developer to turn on all of the protected improvements and fixes in a group, based on levels. For example, they could say, "Give me all fixes up through Java SE 7," or "Always give me the latest and greatest." We considered it for Java SE 6, but we weren't sure what we wanted to include. One example we'll probably include is control over font boldness in the Swing toolkit's cross-platform look and feel. The current look and feel uses bold fonts, something toolkits tend not to do any more.

We've added a property called swing.boldMetal to turn off bold fonts. We can't turn off bold fonts by default because that would interfere with the component sizes of existing layouts. The compatibility API provides the "right" behavior to developers who want it.

Class Favorites

JSC: What is the Java class you could not live without?

Hickey: This goes back to my passion for drag and drop. Some classes are central to the drag-and-drop experience, so for me, TransferHandler is the class that I couldn't live without. In terms of the Java programming language at large, the class I can't live without is ArrayList. It's useful in so many situations -- you don't have to worry about the size of a set of data. And you can dynamically add and remove things.

JSC: What is your favorite Java technology book?

Hickey: Working on the Swing toolkit, I don't read a lot of books about Swing or Java software any more. But two books do come to mind. When I first joined the Swing toolkit team, I learned most of what I know about Swing from either looking at the source code or reading The JFC Swing Tutorial, written by Kathy Walrath and Mary Campione. Even today, when I'm investigating a new Swing area, I refer to it.

My other favorite would be Effective Java by Josh Bloch.

JSC: Almost everyone says that. What is it about Effective Java?

Hickey: The guy's brilliant! And he's extremely knowledgeable about common patterns and gotchas. I recently used the book to aid in a bug fix. I got stuck trying to figure out how I could provide a proper implementation of the equals method to a class and an extended implementation to its subclasses, without violating the equals specification. I started to get the feeling that what I wanted wasn't possible, and so I checked to see what Josh had to say in Effective Java. Luckily for me, he thoroughly covers the equals method in his book, including the exact problem I was trying to solve. I was right: I couldn't do what I wanted to do. But it's so nice to get validation from Josh's book in complete detail and in such an easy-to-understand manner.

JSC: What do you do when you feel stumped?

Hickey: Sun is full of brilliant engineers. So if I'm stumped, I can make a phone call, send email, or ping someone with instant messaging. There's always the Javadoc tool too. Working within the Swing toolkit, I've learned to pick up things from source code. And if it's completely outside the Java technology arena, I use the web.

See Also

Shannon Hickey's Blog
Meet Josh Marinacci of the Swing Toolkit Team at Sun Microsystems
The Swing Connection
Meet Kelly O'Hair, Senior Staff Engineer at Sun Microsystems
Meet Kohsuke Kawaguchi, Staff Engineer and XML Schema Developer at Sun Microsystems
Meet the Engineer Home Page
Java Platform, Standard Edition 6
The JFC Swing Tutorial
Effective Java Programming Language Guide
Ask the Experts - Session on Swing
Vodcast: Shannon Hickey on the "Extreme GUI Makeover" Session at the 2007 JavaOne Conference

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.