A Conversation with Java Champion Victor Grazi

by Timothy Beneke

From startup to JP Morgan Chase and Java Concurrent Animated: a conversation with Java Champion Victor Grazi

Published October 2013

Java Champion Victor Grazi has a long history working with Java that dates back to 1996, when he created a dotcom with his brother Harry called "Supermarkets to Go." He wrote the code and learned a great deal about Swing and database management in what amounted to a Java trial by fire. Around the time the dotcom bubble burst, he started working on the server side at PrizePoint, one of the first online gaming companies.

Next, he found himself at Bank of New York (BNY) building a trading system. By then he had studied for Java certification—a game changer that forced him to learn the nuances of Java. He became the lead developer and after outgrowing the job, moved to a hedge fund where he learned good discipline and process, but was dissatisfied with the emphasis on speed that left little time to test software.

In an effort to shore up his Java EE skills, he took a job at Starpoint Associates, where he put together a team of developers and delivered a distribution management system (based on IBM WebSphere) to manage the distribution of their credit card solicitations, which enabled his team to significantly reduce the amount of junk mail distributed by Citibank.

He began working at Credit Suisse in 2005, where he served as Vice President of Java Consultancy for Credit Suisse Architecture. During 2011 and 2012, he represented Credit Suisse on the Executive Committee of the Java Community Process (JCP). At the time, Credit Suisse was the first nontechnology vendor on the JCP, but was soon followed by Goldman Sachs.

Later in 2012, he moved to JP Morgan Chase where he is currently a Vice President at their Securities Lending Division. He is a frequent presenter at technical conferences where he speaks about his first love, Java concurrency, and other Java-related topics. He was named a Java Champion in 2012 for his contributions to Java.

Grazi is best known to Java developers for work he began in 2009 when he introduced Java Concurrent Animated, a much-praised set of animations that serves as a tutorial for concurrency development.

Victor Grazi
Victor Grazi

Oracle Technology Network: The Java class that you couldn't live without is...?

Grazi: ClassLoader. Seriously; nothing starts until you have a classloader. Sometimes when I am interviewing developers, the first question I ask is, "What's a classloader." If they don't know that, it's a nonstarter.

Oracle Technology Network: Where in the process of programming do you have the most fun? The least fun?

Grazi: Most fun is the design and initial implementation. Least fun is when you get a phone call at three in the morning that there's a bug in your production code. That's why testing is so very vital. Junior and even some senior developers seem to have an aversion to writing tests. There is no excuse for that. We have JUnit, Mockito, PowerMock, so everything is easy to test. There is a tool called Concordion, with which you can prepare integration tests that interface with HTML tables that can be used for end-to-end testing. Tools like that melt away any excuses for not thoroughly testing.


"Sometimes when I am interviewing developers, the first question I ask is, 'What's a classloader.' If they don't know that, it's a nonstarter."

Victor Grazi

Oracle Technology Network: Can you describe the process of writing code?

Grazi: It all starts with requirements. Can you believe that? So many people rush to code without having a clear understanding of what they are building. "We are Agile," they say. What they mean is they are haphazard helter-skelter coders. Code such as that gets built fast, but maintenance is a nightmare and you can be sure that such code will be replaced before it gets to production. Once you have requirements, you can prepare use cases, and then start thinking about your design. JIRA is a must. Then you start building your tests and your code. I am not religious about writing tests before code, but I have noticed that if you leave the tests until after, there is a good chance they won't ever come to be.

Oracle Technology Network: What recent changes to the platform have made your life easier?

Grazi: This is not recent, but I would say tools such as Maven, which set up and build your project, and Jenkins or TeamCity, which exercise your code and notify you of errors, have changed the game. Platform changes? Java keeps getting better with every release. People said they weren't happy when generics first came out but now they are mainstream and I love them. And java.util.concurrent was a major game changer. I love Groovy but I think CIOs are still finicky about using things like Groovy or Scala when they are building a $100M project. So I am happy to see things like Project Coin in Java 7 and Project Lambda in Java 8, which are making Java easier to use. With Project Jigsaw, the jury is still out. OSGi seems to be gaining steam, but it is still not mainstream. I'm not sure why Oracle is placing so much emphasis on modularization. I would love to see them split Project Jigsaw into two parts: one for modularizing your code and one for modularizing the Java platform itself. At that point, Oracle could leverage OSGi itself for part one.

Oracle Technology Network: When you're stumped, what do you do?

Grazi: There are so many smart people to ask. You can go to Stack Overflow or one of the mail lists. It's a great time to be a programmer.

Oracle Technology Network: How do you keep yourself fresh and engaged?

Grazi: By working with smart people and reading things such as Java Magazine and InfoQ regularly and by staying hands-on. Every Java developer must subscribe to Dr. Heinz Kabutz's Java Specialist Newsletter. No matter how advanced you think you are, there is something to learn in every issue.

Helping Young Developers

Oracle Technology Network: How would you help a young Java developer who is just out of school prepare for a first job interview?

Grazi: You know something, I am not much of a believer in paper, but I do think there is great merit in becoming Java certified—not because of the sheepskin but because it is a really tricky test that gets you thinking. Now, certification is no replacement for experience, and one hand washes the other. So developers can get involved in an open source project. There are so many that need help and you can join a JSR by joining jcp.org or visiting SourceForge. Get involved; it is great resume experience!

Oracle Technology Network: In leading a team of developers, what are the biggest mistakes that you have made over the years? Is there any advice you would give to anyone just starting out supervising developers?

Grazi: Never forget Hofstadter's law, which states that a project always takes longer than you planned even if you took into account Hofstadter's law.

Oracle Technology Network: Where do you feel that you are most creative?

Grazi: Algorithms are fun. Concurrency is fun. I think those stimulate creativity. Writing good code is of course essential, but delivering enterprise software is much more than that; it is about process and orchestration, and I find that you need inspiration to be successful there.

Oracle Technology Network: What has surprised you the most about the directions that the Java platform has taken?

"The biggest surprise is that 18 years later Java continues to be the leading programming language, even against Microsoft and all of the polyglot languages."

Victor Grazi

Grazi: The biggest surprise is that 18 years later Java continues to be the leading programming language, even against Microsoft and all of the polyglot languages.

Oracle Technology Network: What is your favorite Java technology book?

Grazi: There are so many good ones. Java Concurrency in Practice, by Brian Goetz and others, is Hemingway. I recently read The Well-Grounded Java Developer by Ben Evans and Martijn Verburg. This is an excellent starting point for getting intermediate developers up to speed with real-life practices.

Oracle Technology Network: Do you ever listen to music when you are coding? What kind?

Grazi: All the time. I grew up in the 70s and I left my music taste there. It ranges from soft rock, such as Simon and Garfunkel, to classic rock, such as Neil Young, the Who, and Led Zeppelin, to classical, such as Chopin, Mozart, and Debussy. Depends what I am in the mood for. If it gets too loud or too fast, then it becomes a distraction.

Java Concurrent Animated

Oracle Technology Network: How many people have now tried out your Java Concurrent Animated app?

Grazi: The app was introduced in July 2009; since then, we've had about 20,000 downloads. Given that there are perhaps 10 million Java developers out there, we are only scratching the surface. Top downloads by country are US 23 percent, India 14 percent, and China 7 percent.

You can download the self-executing JAR file. Then just double-click the JAR file to start it. It is menu driven, or you can use the up and down arrow keys to navigate between the various images and animation slides. It works on all platforms: Windows, Mac, Linux, and so on. Java SE 6 or higher is now required.

Oracle Technology Network: What are the typical responses to it?

Grazi: People tell me that they find it very helpful. Many really get excited about it, especially teachers and team leads who are trying to impart proper concurrency skills to teams. Java was one of the first languages to introduce concurrency into its core library. It was a powerful feature, but we suddenly found some very good programmers writing some very bad code. Proper concurrent programming is difficult to impossible to get right, but if people would take the time to understand some of the frameworks out there, it would make coding for concurrency much less error prone.

"Proper concurrent programming is difficult to impossible to get right, but if people would take the time to understand some of the frameworks out there, it would make coding for concurrency much less error prone."

Victor Grazi

Take for example the Java Memory Model. Developers often ignore it and code away blissfully ignorant that their code is broken, because JVMs [Java Virtual Machines] and servers might not leverage the optimizations provided by the Java Memory Model. But as cores increase in speed and number, manufacturers are expected to take advantage of these efficiencies, and suddenly code that has been working like a charm will start experiencing sporadic failures due to incorrect concurrency management.

Oracle Technology Network: Would you say that your program does some of our imagining for us in ways that enable developers to intuitively grasp Java concurrency principles and processes faster?

Grazi: That's an interesting way to put it. You see, these are not just some Flash animations—they are interactive Java programs such that each animation is actually utilizing the underlying concurrency component it is illustrating. There is a snippet panel on the right side of the screen, and as an animation proceeds, executing code snippets are dynamically highlighted and restored as they execute.

Let me give you an example that happened with the ReadWriteLock animation. A ReadWriteLock is used to ensure data consistency. It allows an unlimited number of reader-threads to acquire a read-lock and operate concurrently. But a writer-thread must wait for all readers to complete before it can acquire the lock. Once a writer-thread acquires the lock, no other reader or writer can acquire it.

Suppose a writer is waiting for some working readers to release the read-lock, and suddenly a new reader comes along. Who should get preference? Should the reader move ahead of the writers—after all, why have a new reader wait around for a waiting writer if other readers are already holding the lock? So that was how it worked in Java 5. But once I started running the animation in Java 6, I noticed the behavior changed, and subsequent readers would wait for all waiting writers to release the lock before acquiring the lock. I thought this new behavior was a bug and mentioned it to concurrency expert Dr. Heinz Kabutz, who explained that it was not a bug but a feature. If new readers were allowed to jump ahead of waiting writers, there is a high risk of producing a thread-starvation condition because there is a high probability that no writers would ever get in, and they would accumulate forever. That's an example of how the animations alter their behavior depending on the JVM runtime version.

See Also

Java Concurrency Animated

About the Author

Timothy Beneke is a freelance writer and editor. His interviews, which cover a wide range of topics including culture, gender, technology, and psychology, have appeared in many journals, including Java Magazine, Mother Jones, the East Bay Express, and the Chicago Reader.

Join the Conversation

Join the Java community conversation on Facebook, Twitter, and the Oracle Java Blog!