Ask 3: Why you should learn Java

By Bryan Hansen    |    January 31, 2018

If you’re ready to master a new technology, it pays to hear from someone who knows. In our Ask 3 series, we interview an expert from our worldwide network of authors to help you learn about the most important technologies today. In our fourth post of the series, Bryan Hansen, a 20+ year Java developer, answers three questions about Java.

Having been a Java developer for more than 20 years, I’ve had the odd pleasure of delivering applications to production using every version of Java since 1.0. Working with Java 9 the past few months, it’s been fun to see the recent features new to this version, and how Java continues to adapt to the ever-changing needs of the industry.


What's the most important thing happening in Java right now? 

Candidly it’s a small enhancement, but it’s changing code profoundly: Java Optionals. These were actually introduced in Java 8, but because of the way framework releases came out, we weren’t doing anything with Java Optionals yet. With the release of Java 9, frameworks have caught up with the Java 8 features that can enhance their libraries.


What's an adjacent skill/technology that complements Java?

Spring 5 was released a few months ago, and with the advent of Optionals, Spring has completely rewritten their API to use Optionals that don’t throw NullPointerExceptions. This will help make code more stable, and it also enhances tooling to better foresee errors they need to handle.

Newer languages on the JVM, such as Kotlin, are already using this syntax—and since they don’t have a legacy of doing it a different way, these languages seem to be gaining adoption rapidly. Scala is also adopting this approach, and that’s why some people feel that it helps enforce best practices.


What's the future of Java for developers?

We are just now seeing the positive ripple effect that Optionals are having on the API. Other languages that run on the JVM, such as Kotlin and Scala, are already embracing this feature and it’s helping this adoption on new projects. In the past 18 months, there’s been a significant rise in the adoption of tools like Kotlin, and this is a direct reflection of how they have embraced this feature. Before Optionals, code could be quite brittle surrounding runtime exceptions and how to best handle errors. As more developers embrace Optionals, I think we’ll start to see better APIs being developed.

In summary, Java 9 adds a host of enhancements that can help improve not only the way you write code, but also the way your code performs. Optionals are a quick way to begin taking advantage of the enhancements Java 9 brings, but there are also more complex features you should become familiar with and understand. The Stream enhancements in 8 and 9 are very complex features that tackle an even more intricate problem. If you haven’t taken the time to learn them, I recommend doing a sprint with these Stream enhancements just to understand the problems they fix and how you can apply them in the future. Also, keep in mind tools like Spring build upon these concepts to help you apply them in your code. Before you dive in, start by getting your Java IQ.

About the author

Bryan Hansen is a Director at Software Technology Group, a consulting company based out of Salt Lake City, and has authored and taught numerous courses in Java. Over the years, Bryan has taught courses on Java Certifications, JPA, Hibernate, Spring, Spring MVC, Spring JDBC, Maven, RESTful Services, Selenium, Automated Testing, CAS, and various security topics.