Tales from the jar side: Fighting Gradle, the Dark Knight of the Antarctic, Groovy Dad Jokes, and the usual silly tweets, toots, and skeets
What kind of key opens the door to a haunted house? A spoo-key! (rimshot)
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of October 22 - 29, 2023. This week I taught my Making New Java Features Work For You course on the O’Reilly Learning Platform, as well as my regular Software Design course at Trinity College in Hartford, CT.
Regular readers of and listeners to, and video viewers of this newsletter are affectionately known as jarheads, and are far more intelligent, sophisticated, and attractive than the average newsletter reader or listener or viewer. 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 to open it in a browser tab formatted properly for both the web and mobile.
I Fought Gradle, and Gradle (almost) Won
The other day I had the following conversation with my son:
Him: You’re a Gen-Xer, right?
Me: No, I’m a Boomer.
Him: Really?
Me: Yeah. The cut-off for Boomers is 1965, and I was born in 1962.
Him: Huh. You don’t seem like a Boomer. You’re not angry enough.
Leaving aside that his definition of Boomers includes a certain minimum level of anger (which, okay, but that does raise other questions), clearly he didn’t see me later in the week when I was struggling to deal with yet another issue in Gradle.
I ran my updated Latest Features in Java course twice recently, upgrading it to the new Java 21 (released September 19 — an “off-by-two” error that still bugs me). I upgraded everything in the build, including Gradle, only to get this warning:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
I was confused, because with everything upgraded, what was the problem? A normal person would have left well enough alone, since this is just a warning rather than an error, but a certain morbid curiosity caused me to try to run with the —warning-mode all
flag to see what was going on. That returned:
The automatic loading of test framework implementation dependencies has been deprecated. This is scheduled to be removed in Gradle 9.0. Declare the desired test framework directly on the test suite or explicitly declare the test framework implementation dependencies on the test's runtime classpath. Consult the upgrading guide for further information: https://docs.gradle.org/8.4/userguide/upgrading_version_8.html#test_framework_implementation_dependencies
Wait, what? Automatic loading of test framework implementation dependencies has been deprecated? Since when? And what am I supposed to do instead?
I followed the supplied link, and found:
If using JUnit 5, an explicit runtimeOnly dependency on junit-platform-launcher is required in addition to the existing implementation dependency on the test engine.
Um, okay? What did that mean, exactly? Ultimately, it meant I’m supposed to add this one line to my Gradle build:
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
Sure enough, that made the warning go away. But as a result, I started digging into the new JVM Test Suites section of Gradle, as described in this blog post, and that was quite a rabbit hole. The bottom line is that now you can completely separate your dependencies for unit tests from those for integration tests or even performance tests, which I guess can be useful. I usually let plugins do that, but now you can do it yourself.
I worked up an example where I did a trivial unit test and an integration test that used the excellent testcontainers library, and they both worked, though they generated different sets of output results.
At the end of that post, it says:
Huh. Okay, I dug into that, too. Unfortunately, I couldn’t find any way to merge those two test reports. All the docs for that plugin involve multiple subprojects, not two different types of tests, so I couldn’t find any decent examples to adapt. I spent way too much time on that, even going so far as to ask a question on the Gradle Forums, with no luck. So at least my code works, but I can’t merge the test results. I suppose that’s not really a major issue. I just wish I knew how to do it, assuming it’s even possible.
The real problem, however, is that unless I add that extra line to all my old Gradle builds, they’ll all give me that warning, at least until Gradle 9 comes out, at which point everything may even fail. That is SO Gradle — they keep “improving” the framework, which leads to more code and worse backward compatibility. I get so tired of trying to keep up with it all. Android already did enough in that mode to drive me away completely. I don’t really want Gradle to do the same, but it’s looking more and more likely all the time.
The only problem is that the major alternative to Gradle is Maven, and no, I’m not going there willingly.
The Dark Knight of the Antarctic
I’ve already mentioned in this newsletter how much of an improvement DALL-E 3 is over the previous versions. I’m still waiting for it to be available via the API, but I’ve been playing with it through the web interface of ChatGPT.
One of the sillier prompts I often use for my tests is:
A penguin, dressed as Batman, fighting crime in the Antarctic
The thing to know about DALL-E 3 is, it’s integrated inside GPT-4, so the prompt you execute isn’t the prompt you specify, especially if you give it something short. But the response it gave me to that prompt was unexpected:
I apologize, but due to our content policy, I was unable to generate images based on the provided description. Please provide a new request or let me know if you'd like assistance with another topic.
I was surprised. Seriously? It can’t give me pictures related to Batman? I didn’t expect that, and that certainly wasn’t an issue in DALL-E 2. So I tried again, slightly rephrasing my request:
A penguin dressed as the Dark Knight fighting crime in the Antarctic
It gave me two images, including one that is now probably my favorite generated image ever:
I put the generated prompt as the caption under the image, but that is so Batman I can actually hear the original Danny Elfman Batman theme song when I look at it.
I mean, look at that image: it even has bats (maybe — they’re a bit too far away to tell for sure) in the background, flying in front of a full moon. Plus, when is the last time you saw an angry penguin (as opposed to the Batman villain the Penguin)? How Batman can you get?
(Of course, I can’t help wondering how he gets into the compartments of his utility belt using those flippers, but given that he’s Bat-Guin, I’m sure he’d find a way.)
The result appears to be that there are guard rails against copyright infringement in DALL-E 3, but they’re pretty low. For example, I tried:
Superman watching over the city by night
and got the same error message, but when I changed it to:
The Man of Steel watching over the city by night
that gave me:
That’s pretty close. In that case, it gave me one image and one error, so it must know something was up. I guess I’ll have to do more experiments to be sure.
Oh, and by the way: speaking of Antarctica, we’re in that silly time when the South Pole — which experiences six full months of darkness and six full months of daylight every year — is currently on Daylight Saving Time. It started on September 24, 2023, and will continue until April 7, 2024. Gotta save that hour, I guess.
Groovy Dad Jokes
Paul King (head of the Groovy programming language and a good friend) published a new blog post on the Groovy blog, entitled ChatGPT meets Groovy one-liners. It’s great, and exactly the sort of thing I like. You should read the whole thing, but let me give you a sample or two.
Paul prompted ChatGPT for so-called Dad Jokes, and then proved them using Groovy code. For example:
Yup. An old gag (that the decimal value 25 is equal to the octal value 31), but easy to show in Groovy. Java also uses a leading zero for octal numbers. Those of us who live in New England are very sensitive to that, because our zip codes start with a leading zero (as in 06447). That means it’s critical that developers store zip codes as strings rather than integers, or you can wind up using base 8 when you didn’t mean to. Experienced developers never have a problem with that, partly because U.S. zip codes have a natural regular expression (like “\\d{5}(-\\d{4})?”
), but beginners occasionally make that error.
In Java, I miss the fact we still don’t have a range operator like Groovy’s double dots. The range shown goes from index 2 to index 0 backwards (i.e., reversed) followed by index 3 to index -1 (the end of the string) forwards. So easy, and we still don’t have anything like that in Java.
Yup, both ignorance
and apathy
are initialized to zero, so the booleans know
and care
are both zero, which, according to the Groovy truth, is false
. Easy peasy, melon (hah) squeezie.
Groovy was created around 2003. I learned about it at a user group presentation on Grails in 2008, and jumped in right away. From around 2010 to 2013, Groovy, Gradle, Spock, and Grails training courses mostly funded my company. Not to mention the fact my first book, Making Java Groovy, came out during that time (current royalty payment (2Q2023) was $3.94).
Anyway, Paul went way overboard on his post, which I loved. Enjoy :)
(Full disclosure: Paul asked me if I wanted to contribute before he released it, and somehow, shockingly, I couldn’t get my act together in time. Sigh.)
Tweets and Toots and Skeets, Oh My!
Down goes Twitter
One year ago this week, Elon Musk officially purchased Twitter. The review articles have not been kind, nor should they be. Here’s the one from the Washington Post (guest link): A year later, Musk’s X is tilting right, and sinking. The article is about Twitter’s descent into hatred and madness, but the other casualty has been Elon’s reputation. I’m still embarrassed to admit I ever thought Space Karen had any business acumen at all. What a complete narcissistic joke, who cares about nothing other than his own press. Ugh. As they say, screw that guy and the sink he rode in on.
Some people there are still funny, however. I found this quoted on Mastodon, but it clearly originated on Twitter:
Happy Halloween!
Winter Is Coming
I do wonder what happened with that one upside-down car.
A million monkeys on a million typewriters…
Oh my, yes. That always reminds me of my favorite critical book review:
Me: What did you think of my book?
You: You know how a million monkeys on a million typewriters would eventually produce the works of Shakespeare?
Me: Yes?
You: Your book? Three monkeys, two days.
Plant Dinosaurs
That’s clever. It reminds me of that time when my son was only about 3, and when we said we were going out to a restaurant, he referred to it as the dinner store. Yes, exactly. :)
AI Be Like
Wow, that really gets the point across, doesn’t it?
Living on a prayer
That may be the best Zeno’s paradox joke I’ve ever heard. Or at least, like the paradox, it’s close enough to the best that the difference doesn’t matter. In the limit, it’s the best.
LangChain4J
That’s the Mastodon post from Paul King I discussed above. I just like the Parrot (symbol of the LangChain project in Python) with the cup of coffee (i.e., Java) for the LangChain4J project. Nice.
Best product review ever
Printers are so deeply evil. I don’t even own one, but I’m not as cool as that sounds since my wife has one I can use on those rare occasions I need one. But that review would make me consider one.
Another Bat-Guin picture
Let’s finish this week with another great image of a penguin dressed as Batman, fighting crime in the Antarctic:
One thing I know is that this Bat-Guin will not be confused by the fact the South Pole is on Daylight Saving Time right now.
Have a great week, everybody!
The video version of this newsletter will be on the Tales from the jar side YouTube channel tomorrow.
Last week:
Making the Latest Java Features Work for You, on the O’Reilly Learning Platform
Software Design, my course for undergrads at Trinity College
This week:
Getting Started with Spring and Spring Boot, on the O’Reilly Learning Platform
Software Design, my course for undergrads at Trinity College
Managing Your Manager, at Trinity College, open to the community
International Developer Career Day, online conference
Which Brother printer is that :D? I'd consider buying as well.