Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.

Java 8 in Anger by Trisha Gee

This time the Virtual JUG treated us to an impeccable live coding performance with the amazing and unflappable (even during demos) Trisha Gee.

This is the third time Trisha has presented to the Virtual JUG. Besides that she’s a regular member of the Java Council podcast and an extremely experienced Java developer, Java Champion and developer advocate for JetBrains! She has expertise in Java high performance systems, is passionate about enabling developer productivity, and a big fan and contributor to open source. Trisha is also the leader of the Sevilla Java User Group and a MongoDB Master.
You can connect with Trisha on Twitter: @trisha_gee, or ping us, @ZeroTurnaround, and we’ll be happy to forward you!

In this post I’ll try to share the highlights of the session and describe how Trisha created a nice looking JavaFX application showcasing Java 8 in action, in under 50 minutes. However, nothing is better than the original, so you should totally watch her live. Just click the video below.

Java 8 in Anger

So to kick off the session, Trisha explained the meaning behind the title: Java 8 in Anger. Surprisingly, it’s not about being furious at your programming language for being stuck in the 80-s, including a verbose API or hard to replicate weird garbage collection bugs. It just means she’ll be using it in real life examples. We’ve all seen numerous presentations about the Streams API, how to use lambdas and so forth with tons of small code examples. This time, Trisha picked a completely different approach: she created an application and developed it in 50 minutes explaining at each stage which Java 8 features she has used and why.

The practical approach much better reflects the reality of a regular Java developer. After all not many of us are paid to create hello world applications. Developing a proper component in a system requires a different mindset. You have to think about the essential parts of the system that are going to interact, create a stub of the components, wire them together, refactor a bit, add the UI (if necessary), and then see if it works. Of course it totally might not work on the first try.

This session was a brilliant example of this. Not the failing part of course! The demo gods were actually pretty lenient to Trisha during the session as the whole thing worked perfectly.

Trisha was planning to develop a simple JavaFX application that fetches data from a Twitter stream, processes it, applies some heuristics to determine the general ‘mood’ of the tweets and shows the results in accessible manner.

Here’s the initial idea as an image:

Screenshot 2015-11-03 19.10.31

One you have settled on a rough wireframe of what it should look like, the next thing to do is to create an architecture. The modern approach to software architecture problems includes using resilient, independent, small sized services. However this talk wasn’t trying to brainwash you on the topic of how to structure your app and where to deploy it.

Screenshot 2015-11-03 19.11.24

The opposite is quite true actually, Trisha explained all the choices she made during the coding phase, from the high level questions like separating the functionality into two independent parts that query the Twitter stream and following the Model-View-Controller pattern, to low-level details of whether to pick a regular for loop or convert data into streams and operate on them in a more functional style.

One aspect which I want to highlight is the way in which Trisha coded during the session. The code didn’t magically write itself perfectly at the first time of asking. If you can’t grasp the exact type of the lambda parameters you need, just rely on the IDE hints or perhaps extract the variables. Maybe write an anonymous class to start with, if you’re more familiar with that approach, and convert it to a lambda later. Luckily, we live in the 21st century so our tools do most of that legwork for us.

Naturally, as a developer advocate for JetBrains, Trisha’s command over Intellij IDEA was very good. Watching someone develop professionally is great. You can always pick up a new shortcut to extract methods, convert lambdas to method references or something so small you wouldn’t even consider to check for.

The best bit was that all the shortcuts used during the session were highlighted on the screen, so if you pay attention while watching the session you might learn a bit about IDEA as well.

Screenshot 2015-11-03 19.18.52

To cut a long story short, Trisha reached the point where the code was written and all was working as expected. The application actually looked pretty solid given it was developed in under an hour. Just compare the screenshot below with the wireframe in the beginning of the post. Cool, huh!?

Screenshot 2015-11-03 19.46.35

Anyway, if you want to learn more about how to use Java 8, lambdas, streams and method references in real code, you should watch the session replay above.
Resources and links

In the session, Trisha referred to several very important links that you should check out. On top of that she mentioned a couple more in the my interview with her, after the session. So to save you time of rewinding the video back and forth and adding your very own typops, here’s a collection of resources for you to click through.

Of course, this list is just a starting point and you should definitely find more resources online. If you prefer to talk to an actual human being, ping Trisha on Twitter: @trisha_gee. I know she’ll be happy to give you pointers and share the experience of learning about these topics!


After the session, Trisha took some time to chat with us on the @ZeroTurnaround interview. Despite speaking on Virtual JUG for the third time, this is the first time we’ve interviewed her.

We discussed productivity and enabling other people inside and outside of your team to become more efficient; about what prevent people from becoming better developers, open source and obviously about the recent Intellij IDEA 15 release. Check it out!


Read next: