Welcome to the ninth ##java podcast. If we were using octal, weâ€™d be on the eleventh podcast by now. It’s hosted by Joseph Ottinger (dreamreal) and Andrew Lombardi (kinabalu on irc) from Mystic Coders and, as a guest, Tracy Snell (waz) on the IRC channel, and itâ€™s Friday, 2017 December 29.
As always, this podcast is basically interesting content pulled from various sources, and funneled through the ##java IRC channel on freenode. You can find the show notes at the channelâ€™s website, at javachannel.org; you can find all of the podcasts using the tag (or even â€œcategoryâ€) â€œpodcastâ€, and each podcast is tagged with its own identifier, too, so you can find this one by searching for the tag â€œpodcast-9â€. The podcast can also be found on iTunes.
You can submit to the podcast, too, by using the channel bot; ~submit, followed by an interesting url, along with maybe a comment that shows us what you think is interesting about the url. Yes, you have to have a url; this is not necessarily entirely sourced material, but we definitely prefer sourced material over random thoughts.
- Up first we have Eugen Paraschiv, from Baeldung, with “How Memory Leaks Happen in a Java Application“. Most Java coders donâ€™t really think about memory leaks, because the JVM is so good at, well, not leaking memory – but itâ€™s still doable, especially when you have long-lasting data structures sticking around, like caches, that can retain references to object trees long past their usefulness. Eugen points out the obvious suspects – the use of
static, for example, to retain references for the duration of the reference to the class – and also points out
String.intern()as a culprit for some. Thatâ€™s more a Java 7 and earlier problem than a Java 8 problem, since Java 8 handles interned strings differently. He points out unclosed resources as an obvious problem – unreleased filehandles, et cetera – and points out badly defined classes being used in collections (as
Objectâ€™s implementation of
hashCode()make retrieval difficult and therefore those objects will last as long as the
Setdoes). He follows it all up with some ways to detect memory leaks. Well done article, although some of the approaches that lead to memory leaks are a lot less of an impact than he implies, especially with the current releases of the JVM. (This does not mean that itâ€™s okay to be ignorant.)
“Some notes on null-intolerant Java,” from Dominic Fox, says that â€Null-intolerant Java is Java in which there are no internal null checksâ€. There are a few variants of this; thereâ€™re libraries that guarantee no methods will return null, other forms that use
Optional, or just throw exceptions if you use a null when youâ€™re not supposed to, or that will defensively check for null on library entry so that you fail immediately if you try to pass in a null when youâ€™re not supposed to. He also mentions Kotlinâ€™s null-checking – using the word “nugatory” for the first time in my experience. (It means â€œof no value,â€ just in case youâ€™re wondering or youâ€™re having difficulty inferring it from context.) His criticism of Kotlin in this case is that the null-checks are there whether you want them or not, and thereâ€™s a performance cost to them… but Iâ€™m not sure how well or deeply heâ€™s measured. Itâ€™s actually a pretty decently written article; he mentions
Optional– as he should, really – but also describes it sanely, meaning that he doesnâ€™t say something stupid like “use
Optionaleverywhere for nullable values.”
The Java subreddit r/java has a comment thread called â€œWhat are features that make Java stand apart from other languages?â€ Lots of interesting comments; the JVM features highly, the languageâ€™s simplicity features, the ecosystem, even the JCP gets a positive mention or two. Itâ€™s an interesting DISCUSSION. What do you think makes Java stand out? One of the things Iâ€™ve liked in Java thatâ€™s changing, though, is the preference for a single idiom; when you look at Scala, you can achieve a given task in eight wildly incompatible ways, but Javaâ€™s historically had ONE way to do most things, and thatâ€™s changing. Iâ€™m not suggesting that thatâ€™s a BAD thing, but itâ€™s something thatâ€™s changing. Essential conservatism in motion, folks!
RxTest is a Kotlin library meant to help test RxJava flows. (Is that what RxJava calls their pipeline processing mechanisms? I donâ€™t know.) Itâ€™s easy to test the simpler parts of event handling mechanisms – you pass it some input, see if you get the right output – but testing flows tends to be a little more involved, because most of itâ€™s asynchronous and itâ€™s hard to test entire streams of processes. Good idea, expressed cleanly, although if you donâ€™t know Kotlin it might be a good time to learn some of it. (This does not mean there arenâ€™t ways to test RxJava event handling in pure Java – itâ€™s just neat to see DSLs for stuff like this.) Also mentioned in this section: awaitility, a library whose name Joe apparently cannot pronounce.
Along the same topic: DZone also has an article on designing a DSL in Kotlin, entitled â€œKotlin DSL: From Theory to Practice.â€ Oddly enough, it also creates a testing DSL, for a learning environment. Youâ€™d think that people would use other problem domains for DSLs more often – but it seems like most examples are build tools or testing libraries. Itâ€™s still interesting stuff. Have you ever used or implemented a DSL? How broadly used was it, how successful do you think it was, and why?
Dan Luu wrote up an article called “Computer latency: 1977-2017” (therefore: “-40,” duh), using a keypress and the time it takes to display that key as a measure of latency. He goes into OS mechanics (simpler OSes display faster, regardless of processor speed) and display refresh ratesâ€¦ really fascinating stuff, even if itâ€™s not Java-related at all. (I kinda wish heâ€™d measured a JVM on some of these platforms, although that would expand his testing matrix considerably.) (Also mentioned in this section: Rastan, an old video game. And it’s “Rastan,” not “Rathstan,” which is what Joe was mistranslating it into. Memory is what it is, apparently.)
DZone is back with “Alan Kay Was Wrong (About Him Being Wrong),” an article talking about one of the primary ways to describe how objects interact: â€œmessaging.â€ (Alan Kay – a person, with a name – is considered one of the fathers of object-oriented programming, BTW.) It used to be that youâ€™d describe an object as “communicating” with another object by way of method calls, so youâ€™d say something like “the model is â€˜sent toâ€™ the renderer, with the
Well, it’s the end of the calendar year – may the new year bring you health, wealth, happiness, and comfort as you attempt to spread the same. We wish you all the best in everything you do.