Tales from the jar side: Gradle version catalogs, Copilot costs, Stack Overflow survey results, and Tweets about RRR, Spring Boot testing, and Earth through Saturn's rings
Why do I prefer dark mode in my code editor? Because light attracts bugs.
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of June 12 - June 19, 2022. This week I taught an NFJS Virtual Workshop on Reactive Spring.
Regular readers of this newsletter are affectionately known as jarheads, and are far more intelligent, sophisticated, and attractive than the average newsletter reader. If you wish to become a jarhead, please subscribe using this button:
As a reminder, when this message is truncated in email, click on the title at the top to open it in a browser tab formatted properly for both the web and mobile. This issue is a long one, so go for it. :)
Gradle Version Catalogs
The latest version of Gradle is 7.4, and one of its additions was version catalogs. They allow you to centralize all the versions numbers for any project dependencies in a single file, which can be updated easily.
Many developers have tried a variety of ways to solve this problem, but now Gradle has their own built-in mechanism. I delayed looking into it, because often when Gradle introduces a new feature, it gets complicated very quickly.
Every once in a long while, however, I dig into a technology and discover I’d worried over nothing. It turned out it was really easy to add version catalogs to one of my projects. I chose this GitHub repository for my new book Mockito Made Clear (now available in beta from Pragmatic Programmers).
All I had to do to start was to create a file called libs.versions.toml
in my gradle
folder. Then I added a sections with the versions numbers I need:
Next, I added a section for the libraries I’m using, each of which referenced one of those version numbers:
I decided that I always use JUnit 5 and the vintage engine together, and I always use Mockito and the Mockito JUnit 5 extension together, so I made those into bundles.
Then I added my two plugins, which are used to automatically update any version numbers that are out of date.
That’s it for the toml file. That last plugin is a version-catalog-update plugin, which adds a versionCatalogUpdate
task to my build. I can run that task to automatically update any of the versions.
Inside my build.gradle
file, the plugins block now looks like:
Note how the dashes in my toml file become dots in the build file. My dependencies
block in the same file is now:
That’s all I needed to change. Now the build works just fine, and if I need to update any dependencies, I just run that Gradle task, which will update the toml file. It’s all good.
Again, you can find both files in this GitHub repository.
One note: you need to be using Gradle 7.4+ for this to work. The current version of Gradle is 7.4.2, and that’s the Gradle wrapper I’m using, which you’ll find in the repository.
GitHub Copilot Revisited
Last week I talked about my experiences with GitHub Copilot, the AI-driven product from GitHub that suggests entire functions or more as you type. The AI is trained on GitHub repositories, including your own, so its suggestions tend to be very reasonable, even when they’re wrong, so you have to be careful when using it.
I ended by saying that the product was free at the moment, but eventually it would cost money, and that would lead to some decisions to make.
During my class this week, my IntelliJ IDEA editor started acting up. Every time I wrote anything, I got a pop-up saying I needed to configure Copilot. I didn’t know what was happening, so I wound up disabling it.
After class, I discovered that yes indeed, they’d gone to a paid model:
The bottom line is that I needed to reauthorize the app in order to start my 60-day trial, after which I would be charged either $10/month or $100/year.
Charging for Copilot brings up issues:
Is it okay to train a neural network on other people’s code and then sell the results?
What if the suggested code matches existing code? Is that a copyright violation?
What if the suggested code has security issues? Whose responsibility are those?
Is this product going to put all of us out of a job?
GitHub is now a division of Microsoft (still shaking my head about that), and Microsoft certainly does not lack for lawyers, so I’m sure they’ve addressed all those questions. When I signed up, I had a choice of whether to accept code that might “coincidentally” match existing code in a public repository which might be subject to copyright restrictions, but most developers copy and paste from public repositories (or sites like Stack Overflow) all the time. There was also a disclaimer about security issues, which is part of the Frequently Asked Questions list.
As I mentioned last week, my biggest issue with Copilot is that the suggested code always looks plausible, even when it’s wrong. I talked to a friend of mine who is currently coding in a couple of languages where he doesn’t have a lot of experience, and he’s finding Copilot extremely helpful there. I’d be concerned about that, but if you have test cases (and you always should anyway), you’ll probably be okay.
In the end, I decided to go for it. To me it’s a “code assist” tool like any other, and I’ve found it more helpful than not. I’ll let you know if I continue to find it beneficial.
And no, I don’t think it’s going to put developers out of a job. It’s a good way to generate boilerplate code for tasks that have been done many times before, and if that’s all you do in your job, you’re already in trouble, since there’s certainly somebody cheaper out there who can do the same.
Stack Overflow Survey Results
The giant Stack Overflow survey of developers announced its results this week:
Yes, that’s over 73,000 developers. As it turns out, I wasn’t one of them, mostly because the survey was really long this year, I got bogged down, and never submitted mine.
Here is a direct link to the results. They’re interesting, but I’ll call out a handful that I found somewhat surprising:
Only a bit over half (55%) of developers learn from books. Online resources are much more popular. That’s skewed very much by age, in that younger learners go almost exclusively for online resources, while the over 45 set goes almost 85% for books.
Of the online resources, over 88% go for the technical documentation, which I find reassuring. One if the issues I have with Mockito is that the available documentation is not as helpful as it could be, and at least one reviewer suggested I ignore that. I’m not sure that’s the right thing to do.
Half of all coders have been coding for 10 years or less, and 75% have been working as a coder for less than 14 years.
We have issues with diversity (a whopping 91% of the respondents were men), but we are an extremely international community. The US had the most respondents, but even that was only 19%, followed by India with 9%, and going down from there. We are all over the world.
Here’s the age range. When sorted by professionals vs learners, 46% of professional coders are between 25 and 34, and more than half the learners are between 18 and 24. We’re still a very young profession. (I turned 60 in March, which puts me in that tiny 2.79% sliver.)
Java has fallen to 6th among most popular languages (33%).
Spring has dropped to 4th among “Other Frameworks” at only 16%.
VSCode (Visual Studio Code) has surged into the lead among Integrated Development Environments, with nearly 75% of developers preferring it. Wow. IntelliJ is a distant third at 28%, and Eclipse is way down at 9th with only 13%.
The survey contains a ton of information, from employment status to salaries to tools like Slack and Zoom. Have a look if you’re curious.
Tweets and Other Stuff
RRR
If you haven’t heard, the Indian hit movie RRR has broken through in the west. The movie has over a 90% rating on Rotten Tomatoes, and is now available on Netflix. As Patrick H. Willems titled his video about it, RRR is The Biggest Blockbuster You’ve Never Heard Of, and it rules.
It’s long (just over 3 hours), but it has everything — a buddy movie, a romantic comedy, action adventure so over-the-top it should make Marvel hang its head in shame, an awesome song and dance number (both leads apparently are fantastic dancers), good vs evil, a vague connection to history, and much, much more.
It was a little more cruel and violent in parts for my tastes, and the Hindu nationalism is laid on with a trowel in the musical number after the end credits, but if you’re only exposure to Indian cinema is Bollywood (or not even that), this “Tollywood” movie is way more of everything. The two leads are loaded with charm, and the movie starts with one of them fighting a battle between a wolf and a tiger, and goes up from there.
Here’s the Naatu, Naatu dance number on YouTube:
(Don’t worry, on Netflix it has English subtitles.)
The movie has inspired articles in publications from The Atlantic to the New York Times. Seriously, give it a try.
Northstar Dev Group
I’m speaking this week at the Northstar Developers Group online:
There’s still time to register if you’re interested.
Explains A Lot
Now you know.
Spring Boot Testing
My friend Greg Turnquist did a live stream on testing Spring Boot applications.
See his Spring Boot Learning site for this and other videos.
Greg is the author of several books, including Hacking with Spring Boot 2.4: Classic Edition. See his website for details.
To The Moon, Alice
I’ve always loved this re-tweeted picture, which came from the Cassini spacecraft orbiting around Saturn:
That’s the Earth and Moon system, viewed through a gap in Saturn’s rings. How cool is that? Every single person who ever lived was on that bright dot. Twelve of them made it to that smaller dot on the left for a very brief period of time. Only four of them are still alive:
Buzz Aldrin (Apollo 11, on July 21, 1969), age 92
David Scott (Apollo 15, on July 31, 1971), age 90
Charles Duke (Apollo 16, on April 21, 1972), age 86
Harrison Schmitt (Apollo 17, on December 11, 1972), age 86
That’s it. That’s the whole list. NASA is talking about going back, but the program has been beset by delays (now 2025 is the earliest). SpaceX talks vaguely about it, as a step to Mars, but I think we all know to take any timetables proposed by Elon Musk with a huge grain of salt.
Will the next person make it there while the previous group still includes a survivor? We’ll see.
Speaking of Astronomy
Queen’s A Night At The Opera still holds up after all these years.
The SCOTUS decisions this week
Nope. Not going there. I don’t have anything to say that many others haven’t already said, and this probably isn’t the place you want to see me say anything about that anyway.
(If you’re wondering why this newsletter is a bit later than normal, it’s probably because of this section.)
I’ll leave you with this, which is a good, if difficult, sentiment:
Have a good week, everybody.
As a reminder, you can see all my upcoming training courses on the O’Reilly Learning Platform here and all the upcoming NFJS Virtual Workshops here.
Last week:
Reactive Spring, an NFJS Virtual Workshop
This week:
Spring Data Fundamentals, on the O’Reilly Learning Platform
Spring Data and the Java Persistence API, an NFJS Virtual Workshop
Speaking at the North Star Dev Meetup on Thursday