The Stack Overflow Podcast

Java, but why? The state of Java in 2024

Episode Summary

Ben and Ryan chat with listener, professional pilot, and Java enthusiast Lenny Primak about what he finds exciting about Java in 2024. Lenny started using Java around 1997 as a college student. He got his first Wall Street job right before he turned 18, working with programming languages like C++ and distributor trading systems before becoming a pilot in 2007. Since then he has been an avid Java programming hobbyist. Why get excited about Java? According to Lenny, he finds Java to be a brilliant technology, far ahead of its time. He loves that Java is no longer a verbose language as it was in the early days, works well on machines, has had no recent security breaches, and no real failures attributed to Java not working. In addition, every six months you get a production quality release.

Episode Notes

You can connect with Lenny Primak at Flow Logix, X, LinkedIn, Github, or Mastodon

Got questions about Java? Check out the site.

Apache Groovy is a Java programming language. 

Virtual Threads reduce the effort put into writing and maintaining code as well as observing high-throughput concurrent applications.

Apache Shiro is an open-source security framework that can do authentication, authorization, cryptography, and session management. 

Jakarta EE, or Jakarta Enterprise Edition, is a suite of services that helps developers write enterprise applications for the Java platform. 

Episode Transcription

[intro music plays]

Ben Popper Hello, everybody. Welcome back to the Stack Overflow Podcast: Java, but why edition. This is your host, Ben Popper, Director of Content here at Stack Overflow, and I'm joined by my co-host, Ryan Donovan, and one of our listeners who wrote in to chat. Ryan, today we're going to be talking about the state of Java in 2024. I feel like we've done hundreds of episodes of the podcast and whenever Java comes up it's always sort of a, “But why?” It will never stop, and did you know it's not as bad as you think? That's usually the vibe that I'm getting from people. 

Ryan Donovan We've talked to folks on the Java teams, and Java was one of those languages I started with in college so I'm interested to see how it's kept up with modern tooling. 

BP Great. Well, our guest today is Lenny Primak, a listener of the Stack Overflow Podcast who wrote in to chat and has a lot of experience working with Java all the way back from what– the mid-2000’s? How long have you been doing this?

Lenny Primak Probably 1997-ish. 

BP 1997, okay. So a few decades of experience working with Java and some thoughts on how one would go about using it today and where it fits in the ecosystem. Lenny, welcome to the Stack Overflow Podcast. 

LP Thank you. I appreciate being on the podcast. 

BP One of the things that I'm curious about is how did you get your start in the software industry? What brought you to the area of expertise you have today? 

LP I started working with computers when I was 16. I started my first Wall Street job. I wasn't even 18 years old, and I worked a lot with C++ and C, mostly in real time distributed trading systems. And I worked with those until about 2007 when I decided to go full-time into being a pilot.

RD So you're a pilot now. Do you do any Java coding? 

LP I do. Don't tell anybody, but being a pilot is not a full-time job. It's half-time at the most, so I do some programming as a hobby and just keep up with technology and do side projects. I used to make money with it, but now I want to take it a little bit easier so I'm just purely doing it as a hobby now. 

RD So I started with Java in about 1997 also as coursework, and it was definitely the hot new language back then with multi-threading and it runs on any system, but at jobs later, people ran into problems where you sort of had to test on every single system because the VMs were shaky. What is it about Java today that you find so compelling that you like? 

LP A lot of people have that experience. They were introduced and were using Java back in the early days, as we call them, ‘the bad old days,’ and they had an experience with it. Just like any early language has their teething problems and things like that, it was a brilliant technology at the time. I would argue it was a little bit ahead of its time. And yes, there were all those problems. The language was too verbose at the time and the VM didn't work very well on all the machines. But this is 2024, about 30 years and a few billion dollars later in investment in the ecosystem and Java is no longer verbose, machines are rock solid, you have all the JVMs for all the platforms working exactly the same way. I'm sure everybody listening would agree that we haven't heard any major security breaches with the language recently, nor have we had any sort of failures that are attributed to Java not working specifically on this machine. And the old adage “write once, test everywhere” is no longer true at least for the language. Obviously if you're using native code, that's a different question– you'll have to test that. But a lot of things that people attribute to Java back in the day is no longer true and Java is pretty modern. One of the things that a lot of people don't know is that currently Java is being released on a six-month cadence, which is that every six months you get a production quality release with all the new features, and if you wish to –which I personally do– upgrade every six months, then you don't really see any problems, at least in the last five years. And what's amazing is that every six month release is on time 100 percent of the time. Oracle has never been late with a Java release. I think there was one regression in the last five years when they had to patch it within a few days, otherwise these releases have been rock solid on all platforms and I think that's amazing in the software industry today. 

RD Yeah, I remember. And that's a big deal for people who know Java, because I worked at a company that worked entirely in Java about 10 years ago and they, for fear of the upgrade path, did not upgrade for four or five whole versions because it was a big deal.

LP And that's a double-edged sword with Java because it works so well. The current versions work so well that it's like, “Why upgrade?” And then people are complaining that Java is old, and that's because you don't upgrade. If you upgrade, you can use all the cool new features and you don't have to worry about it being old. 

RD So for folks whose knowledge of Java is just the applet days, what are the cool new features? 

LP What are the cool new features? First of all, what Java has currently is that basically all the languages have certain fortes. Java is very fast. It's always been fast and it's fast in a way that's high-level language fast, which means you can write your code in a very brief, very concise way, and at the same time, your executable is very fast. It's a fast language. It's a green language. There are these tables that are online that are these research projects. It's the number three or four greenest language, which kind of means it's the number three or four fastest language. And for a high-level language, it's the only high-level language that's on the top of the list. All other high-level languages are way to the bottom. For example, Python is almost a hundred times slower than Java. Ruby I think is 50 times slower than Java. So all of those languages are good and high-level, but Java is the only one that is super duper fast. As far as the features, you have a lot of functional features that are brought over from the functional programming land. Streams are a fantastic feature in Java. Also, brand new features that are good for AI these days are a vector API that is in preview right now, which is usable for production if you choose to, but Oracle reserves to change little things here and there. And so the vector API, people are already making use of it to run models locally entirely in Java, so that is something. And also a lot of AI things are being written in Python because it just doesn't call a methodology to call a C library underneath. The latest Java versions have APIs that are very easy to call to go into C code. So actually a combination of Java and one of the JVM languages, which is Groovy, and the memory and the vector APIs, basically give you everything you need to do AI in a high-level type safe way that is fast, almost 100 times faster than Python, and just as easy as Python would be. And I think that's a fantastic thing. 

BP So in our discussions with folks across the industry, it does seem like Python has become the major center of gravity– something that is commonly now suggested as a great beginner language for folks, that is taught at the university level, and that is widely used throughout the new world of machine learning and data science and Gen AI. Are you suggesting that Java could be utilized alongside that, or that folks who are already, like yourself, experts in that world have a great opportunity to work in parallel?

LP It's both. If you are using Python and you're happy with it, you can continue using it and that's perfectly fine. However, most enterprise applications are Java, and if you're integrating AI into your current enterprise application that's in Java, there's no reason to go to Python. 

BP Got it. So more of the convenience and cost savings and headspace savings of an enterprise that wants to add some of this new Gen AI stuff but has all their existing stuff done in Java, they don't need to try to port over and change everything to Python. I gotcha.

LP Yes. And if you need scripting, again, Groovy is a great language for scripting. It's completely Java compatible, but it's been inspired by Ruby to do the scripting but it works with the JVM, completely integrated with the rest of the Java ecosystem. So you can do your scripting in Java, you could do all of your AI scripting in Java, all your data sciencey stuff in Java just by using Groovy as your easy path into the world of dynamic typing and having great scripting. 

RD So how about the business state of Java now? I know it's either open source or open source adjacent. There was some concern when Oracle took it over that it would become a little less open. How is it for developing on? Is it fully open source? 

LP Both Sun and Oracle have historically made all the mistakes they could with open sourcing Java, however, that's all been fixed a long time ago. Java is completely open sourced. It's GPL-licensed with a classpath exception. That means you can use Java and Java libraries without your business having to open up the business source code, pretty much just like any other open source you can use. However, if you do make a modification to Java, because it's GPL, you would have to open up the source code if you modify Java. But if you use it or use any of the libraries, your business can keep the source code completely closed if they choose to. The only issue that remains –I don't know if it's an issue or not– the Java trademark is kept with Oracle, so you just can't call something that you create ‘Java’ without paying Oracle for the trademark, and I don't think anybody's doing that. Pretty much the confusion is that all the Java stuff, Java code, is open source and freely available to use, but the trademark, you just can't call your own thing ‘Java,’ because Oracle owns the trademark. I think that pretty much simplifies all the complicated stuff that's been going on.

RD Is that what led to all the other JVM languages like Kotlin? 

LP No. JVM is a brilliant piece of engineering. Again, that's what makes Java super fast. It's even faster than C++ in some cases, in concurrent cases, because if you write something in C++, you'd have to allocate memory. When you allocate memory, it's locked per thread basis. In Java, that's not the case. Concurrent memory allocation happens with zero locking in Java. So if you write concurrent code, you can make it faster than C++ really. Virtual threads is a whole different ball game. There used to be, in Java world, we call it ‘used to be’ now, is the fad called ‘reactive programming,’ and it came from JavaScript. JavaScript is a single-threaded language, and in order to make concurrent programs in JavaScript, you have to go through all this rigmarole of promises, async/awaits, and all that stuff. And you're still running on a single thread, you're just doing user LAN scheduling like back in Windows 3.1 days, or maybe Windows 2 days, even. So that kind of reminds me of that. So Java went the other way which is using real threads and real concurrent programming, real multi-threaded programming. However, in a highly scalable world, you can do both. So in order for Java not to follow the JavaScript path where you have to do async/awaits everywhere and do promises everywhere and do all sorts of rigmarole to make that stuff work that's impossible to debug, Java virtual threads makes it easy. You write your code like you used to in an imperative way, you just call your methods and don't even worry about it. Whatever you need to do to work 10, 20, 30,000 concurrent requests in one machine, it'll just work. You can create millions of these virtual threads and the scheduling will just be done for you. No async/await, no promises, no completable futures. You just write your code in an imperative way, and when you need to debug it, your stack trace will be your pure stack trace where you just see what exactly is going on, what exactly is going wrong, and you can just see it and fix it. 

RD That seems super interesting, but I think the folks who are doing low-level programming, there's a part of them that I think wants to hold on to every piece of it. They want to assign all memory manually, they want to assign all threads manually. Do you think that is a limiting mindset? 

LP Well, there are use cases for low-level programming. There absolutely are. And if you want to do low-level programming, you can absolutely do it and you can succeed at it. In fact, if you want to do low-level programming, you can pick your code, you can pick your REST. Don't pick C++. You're going to hurt if you pick C++. But if you're writing business applications, if you're writing something that does functionality outside the world of kernel development, or even a lot of command line stuff with crawl VM you can compile natively. There are few use cases for low-level, but most of the regular typical use cases that businesses have are more suited to Java than a low-level program.

RD I saw that my previous job was the backend system for a service architecture, so it wasn't close to the metal but it was handling a lot of concurrency. 

LP Concurrent programming these days, Java can handle it, in my opinion, better than any other language. Because if you do a low-level language, if you start writing this stuff, first of all, you don't have support for libraries that have been written and optimized for the last 30 years. You just don't have that, and what happens is that you write your code and then you're like, “Uh-oh, now I’ve got to debug it. Now it's also low-level. Now I've got to maintain it.” All that stuff is 3,000x more difficult than people think it is, and if you're going to start from scratch, most likely you're either going to miss the boat with your marketing or you're just not going to succeed in your business goals because Java is so much more productive just because it's a high-level language. In fact, I'll give you an example. I worked in a trading system that was in optimized C++ code. It was beautifully written, everything was perfect, smart pointers, but however, at some point there was some second delays, like one second or one and a half second delays and nobody could figure out why. I spent I think six months trying to debug it because it happened once every two weeks and you can't reproduce that. And that's the problem with low-level programming. There's probably some kind of bug that is so deep in there that you just can't figure it out. And that's kind of what happened, and I consider that my best quality is to be able to debug impossible to debug problems. People come to me like, “Can you debug this? I can't figure anything out.” So I tried for six months to debug the C++ program and I couldn't, and that's kind of the issues you get with low-level languages. 

RD Do you have a favorite bug you found? Is there a trophy piece you put on the mantle? 

LP Oh, yeah. I think I spent four all-nighters, and one of our other brilliant engineers wrote this code and he missed a byte. There was this bug where there was a byte that he missed. I believe it was point arithmetic or just plain math, and there was an edge case where he missed it by a byte. And we had something that was not working– again, once every week it was coming up. And I spent four nights. I had five or six screens going on at the same time stepping through debuggers, all the distributed pieces of the code, and I just happened to find this one missed byte. I'm like, “Oh yeah, this is why this thing's not working.” And that byte is basically the length of the array tree. It was just cascading from there. So that's kind of my big bug that I found in the C++ code.

RD Amazing.

BP All right, I want to pause here. Is there anything that you can say about this dual career that you've had? We talked a lot about programming and your love for finding bugs and the challenge of that. You're telling me that you're a pilot. That's full-time?

LP Yes. I fly private jets for a living right now.

BP Okay. I have to understand what is the appeal of that over programming? Do they scratch the same itch in certain ways or they're completely different? You just needed a break, or did you reinvent yourself here? 

LP I loved flying from when I was a little kid. I loved airplanes, I loved everything about airplanes and I never thought I could actually go and do any of the actual flying. When I figured it out, I flew for a hobby for a long time and then I'm like, “I want to fly jets.” And the only way to fly jets is to go to the airline, which I did. And I didn't think I was going to like it, but I loved it. What's different about flying is that when you're done with the flight, you're done. There's no lingering bugs. There's no deadlines. Once you're done, you're done. And that's kind of different, but it's got its own challenges. There's a lot of mental. Most of the flying isn't physical, it's mental. How do you get through some weather? You’ve got to figure out what your plan is, for example, if there's a difficult approach, what your alternate airports are, and do you have enough fuel, and how do you put all these people and bags and have enough fuel, what if something goes wrong, things like that. It's a very mental game. 

BP I like that. The Tetris of planning and prepping and redundancy is activating that same part of your brain. 

LP Exactly, exactly. And I love it, and I like to do my software development on the side because, again, I set my own deadlines and I don't have to worry about any kind of issues that come up.

BP One topic de jure question– you said you've been doing this since the late-90’s. You obviously have a great love for Java and some of these languages that emphasize speed but also a lot of control. Do you play around at all with code assistant code completion tools that can help finish a line for you, finish a function, suggest something, write a unit test, look for bugs, any of that stuff?

LP What a great question. I've been using GitHub Copilot for the last three months with IntelliJ IDEA. So I'm kind of different, I've never copied and pasted code from Stack Overflow ever. I love looking at Stack Overflow and getting inspiration for my code, or how is this done, but I've never found a piece of code that I need to copy/paste. Why is that? Because there are lots of libraries that I can use. Basically, Stack Overflow will inspire me to use a library, or if there's no library, it will inspire me to write some code that I want. I'm a minimalist. I write as little code as possible. To be honest, the kind of code I write, I have maybe 1-2% good suggestions for Copilot. As for writing code, for me, it's not very useful. However, writing tests, writing documentation, writing code commit comments, writing function comments, method comments, picking class names, I found that helpful. 

BP Okay, I like that. That's a view of where it fits you and where it doesn't. And I could see added efficiency, but also a distance between what ultimately is going to be important in there and what you trust to yourself. I like that. 

LP Yes. And there's many times where I've had it complete a function and then I'm like, “Oh no, this is completely useless.” 

RD So the open source projects you're working on, how did you select those to work on? 

LP As a user, just like Java, I didn't pick Java– Java picked me. I've used, basically as a user, a whole bunch of stuff. And what I want from a program or from a language is something that stays out of my way, that works the way I want with no surprises, and something that I kind of stylistically like. So I was a user of Apache Shiro, and Apache Shiro is a security framework, and I was just contributing to that. I just found the missing features and bugs that I wanted to fix and I fixed them and I fixed them for a few months, and after that, the committee was gracious enough to invite me in and I got into the committee for Apache Shiro. So I love software security and I love working on Apache Shiro and I think it's the best security framework out there. It's a little low-level, but in my opinion, it's absolutely the best. The other thing is, I loved the Jakarta EE ecosystem, and there was a few missing pieces– just a few, not too many– from Jakarta EE, and I wrote my Flow Logix library. It's a component library for Jakarta EE. I've been working on that for years and years and years. And I think it's great, I think it's a great addition to the Jakarta EE ecosystem. And for me, Java, Jakarta EE, the Flow Logix library, and Apache Shiro make for an amazing– sprinkle maybe a little Kubernetes which took me three months to learn which was kind of crazy– a little bit of Docker and Kubernetes on top of that, it makes for a perfect infrastructure.

[music plays]

BP All right, everybody. It is that time of the show. We want to shout out someone who came on Stack Overflow and helped to spread a little knowledge. Congrats to Kvam, awarded a Lifeboat Badge on May 23rd for giving a great answer and saving a question. This was asked eight years ago: “What is the advantage of using a Bitarray when you can store your bool values in a bool[]?” And then we have an answer here with a score of 20 or more from Kvam, and we've helped 15,000 people who had a similar question. So I appreciate it, Kvam, and congrats on your badge. As always, I am Ben Popper. I'm the Director of Content here at Stack Overflow. You can find me on X @BenPopper. If you, like Lenny, are a listener and you want to come on and chat about something, if your chosen language is not getting the respect it deserves, you're welcome to come on here and air your hot takes or just lay down a bit of what you've built and let people know. We like that a lot. Email us: podcast@stackoverflow.com. And then really the nicest thing you could do for the show and Stack Overflow if you've enjoyed listening is to leave us a rating and a review. It really helps. 

RD I'm Ryan Donovan. I edit the blog here at Stack Overflow. You can find it at stackoverflow.blog. And if you want to reach out to me with your tech opinions, you can find me on X @RThorDonovan. 

LP And I'm Lenny Primak. You can find me at flowlogix.com with an ‘X’ instead of a ‘CS’. I'm @LPrimak on Twitter and Mastodon and all the other socials. And check out Apache Shiro if you need a security framework for Java.

BP Wonderful. All right, everybody. Thanks for listening, and we will talk to you soon.

[outro music plays]