The XVIIth podcast is live! … one wonders why the Roman Empire didn’t last much longer, doesn’t one. One also wonders how long one can refer to oneself in the whatever-person this is. (It’s… second-person? No, folks, it’s “third person.” English grammer fumbling and lesson over.)
In this podcast, we chase a few things: the discussion topic centers back around on Python vs. Java, and why one might encounter one over the other in certain situations.
We also jump down the gullets of a lot of varied topics, only some of which are Java, but most are at least sort-of relevant:
switch statements in java! … Stuff we can look forward to in Java 12. Java’s looking more and more like Kotlin all the time.
- Hibernate with Kotlin â€“ powered by Spring Boot describes, of all things, using Kotlin, Hibernate, and Spring Boot together. (The summary has a good laundry list of things to pay attention to.)
- Another Java Enhancement Proposal: the Java Thread Sanitizer. It would provide a dynamic data race detector implementation for Java and native JNI code utilizing ThreadSanitizer in OpenJDK with interpreter and C1 support… and while it’s great that tools like this might exist, it’s fantastic that they’re apparently rarely needed if they show up twenty years after Java’s release.
- The Left Hand of Equals is not strictly java related, but still interesting. It mostly centers around what it means for one object to be equal to another. I wonder if the channel blog should have recommended LINKS as well as booksâ€¦.
- TomEE: Running with Systemd is a pretty fair walkthrough, and should be applicable to other app servers as well… that is, if appservers are still relevant in the world where microservice containers do be existin, mon.
- https://brilliant.org/ is a kinda neat site for math and logic skills. If you use it, don’t forget to take the question surveys, because that’s how it’ll improve.
- How to Be a Person Who Can Make a Damn Decision is the first of at least two annoying links for Andrew – this one says it’s “how to be a person who can” but actually mostly documents people being those kinds of people. We also have the resurgence of the podcast drinking game; take a shot whenever game theory is mentioned. However, the article doesn’t really have a lot of takeaways, apart from pointing out that the ability to make a decision quickly is probably a worthwhile skill to have.
- OpenPDF 1.2.1 has been released. Joe didn’t even know about this library. No idea how useful it is; this release doesn’t look like a big one from the surface, but still: the more libraries out there, the merrier, right? (Unless they’re logging libraries.)
- 7 Scientific Benefits of Reading Printed Books is the second annoying link for Andrew. It goes over some, uh, tenuous reasons print books are worth reading, some of which were taken exception to. Joe thought it was worth thinking about when e-books are ALL the rage for programming topics…
- Other tangential topics:
- https://hmijailblog.blogspot.com/2018/08/you-could-have-invented-lmax-disruptor.html I hated reading this, so I stopped.
- https://perens.com/2018/08/22/new-intel-microcode-license-restriction-is-not-acceptable/ Apparently Intel was saying not to publish benchmarks, which is kinda gross. However, worth noting is that after the initial scraping of this article, Intel backed down and changed the police. Way to go, Bruce Perens!
It’s only been six months, so it’s finally time for a new podcast. This one doesn’t even pretend to go over the mountains of killer content from ##java since the last podcast – it focuses on some of the more recent links, and that’s it. Well, apart from talking about the Java ecosystem a bit, especially in contrast with Python, an upstart language that’s making a lot of headway lately thanks to a giant upsurge in data science applications.
(A bit of irony: the very first paragraph in the podcast says it’s only been “four months” when it’s actually been six. Yikes.)
But there are some interesting links, and here are the ones the podcast focused on!
- The Apache Maven compiler plugin has been updated to 3.8.0, includes module-info support; default Java version is now 1.6, only two versions out of date
- NetBeans 9.0 has been released, and both Netbeans users rejoiced. You go, you two!
- https://github.com/GoogleContainerTools/jib is a gradle/maven plugin that builds a docker container easily. May not work well with https://aboullaite.me/docker-distroless-image/ but thereâ€™s more than one way to skin a firetruck.
- String literals are targeted for JDK 12 as the first preview language feature.
- JDT-Codemining is an eclipse plugin that decorates various nodes in your java code with live-updating useful info. Examples: * Did this @Test pass in last test run? * What are the param names for this method call? And an IDEA plugin that pulls completions from a public repository: Codota.
- “YAML: Probably not so great after all” is not a great article, but it points out that YAML might contain insecure data (like commands to run that arenâ€™t wise) but does have a good point that the YAML spec is enormous for such a simple-looking document format. An alternative lately seems to be TOML, though: https://github.com/toml-lang/toml and a Java library for TOML (with no recommendation) is: https://github.com/mwanji/toml4j
- https://github.com/schibsted/jslt provides XSLT-type transformations for JSON.
- https://blogs.oracle.com/java-platform-group/a-quick-summary-on-the-new-java-se-subscription – an important rollup from Oracle on the nature of new Java releases. Chances are Oracle’ll be fine, what with corporations handing them money for the Oracle JVM and support… but everyone else should go ahead and use OpenJDK.
- https://itnext.io/pros-and-cons-of-functional-programming-32cdf527e1c2 is a decent rollup of functional programming. The best summary I’ve seen for it is still a book, though: Functional Programming in Scala. The book is good. Scala is not. 😀
- https://jaxenter.com/understanding-jakarta-series-tijms-147953.html brings up the idea that Jakarta EE (the new name for Java EE) might be more useful as a collection of specifications than as a deployment environment. The age of the containers might have passed, killed off by the new and ascendant microcontainers.
- https://javachannel.org/java-books/ – the channel website finally has a list of recommended Java books! If you think this list needs to be amended, feel free to send in your suggestions.
- Quick hit from ##java: files to commit in the source repository? the entire project folder, ignoring .classpath, .project, .settings/, *.iml, *.ipr, .idea/, and *~.
This was written with the new editor plugin for WordPress, called “Gutenberg.” It’s a lot like Medium.com’s editor. It’s effective for writing… unless you have any actual features you want in the text.
Welcome to the fifteenth ##java podcast. Your hosts are Joseph Ottinger, dreamreal on the IRC channel, and Andrew Lombardi (kinabalu on IRC) from Mystic Coders.
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-15â€.
Discussion today centered around specifications: any good ones out there? What would good specifications look like?
A few podcasts ago (podcast 11) we mentioned â€œresilience4jâ€ – well, there’s also retry4j on github. Itâ€™s another library that offers retry semantics.
retry4jâ€™s semantics are really clean; maybe itâ€™s me (dreamreal), but it seems more in line with what Iâ€™d expect a retry library to look like.
From Youtube, we have a video showing how to use Graal in the JVM. Graal exposes JVMTI internals – which means that theoretically you could write a replacement for the just-in-time compiler, and change some fundamental ways of how Java works. Twitter is using Graal today, and the presenter says that it works fantastically; itâ€™s also slotted to become standard in the next few revisions of Java, so weâ€™ll have it probably next month or so.
From the channel blog itself, user yawkat posted a way to cache HTTP results regardless of response with OkHttp. Why is this important? Well, if youâ€™re testing a crawler, itâ€™s handy to not slam the target server – even on results that should give things like â€œnot found.â€ Itâ€™s written in Kotlin; the Java code would be trivial (and maybe we should post it as well just for the sake of example) but itâ€™s still pretty handy.
Thereâ€™s also a Java Enhancement Proposal to allow launching single-source-code files like “java File.java”, and it automatically invokes javac; also with support for shebang, so we could be looking at Java scripting before too long. Some people already do this with scripts; they have something that pipes Java source into a temporary file, compiles it, and runs it, but this would be more standardized.
Weâ€™ve seen a few posts about Hibernate on the channel lately, including some about projections (where an object isnâ€™t represented as such in the data model but is constructed on-the-fly). Vlad Mihalcea actually had an appropriate post about caching such projections.
We also have seen references lately to Project Sumatra – GPU enablement for the JVM, which seems abandoned – and then thereâ€™s this from the valhalla developerâ€™s list: there IS a GPU exploitation thing being worked on. Who knows, we might see highly-GPU-enabled JVMs or libraries innate for Java before long.
DZone has an article called â€œJava Phasers Made Simple” – basically a set of limited-scope locks. Itâ€™s really well done although quite long; hard for it to go into detail without being fairly long, though, so thatâ€™s okay. Worthwhile read.
Welcome to the fourteenth ##java podcast. Your hosts, as usual, are Joseph Ottinger, dreamreal on the IRC channel, and Andrew Lombardi from Mystic Coders (kinabalu on the channel), and itâ€™s Wednesday, February 7, 2018.
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-14â€.
javan-warty-pig is a fuzzer for Java. Basically, a fuzzer generates lots of potential inputs for a test; for example, if you were going to write a test to parse a number, well, youâ€™d generate inputs like empty text, or â€œthis is a testâ€ or various numbers, and youâ€™d expect that your tests would validate errors or demonstrate compliance to number conversion (this is a way of saying â€œit would parse the numbers.â€) A Fuzzer generates this sort of thing largely randomly, and is a good way of really stressing the inputs for the methods; the fuzzer has no regard for boundary conditions, so itâ€™s usually a good way of making sure youâ€™ve covered cases. The question, therefore, becomes: would you use a fuzzer, or HAVE you used a fuzzer? Do you even see the applicability of such a tool? Thereâ€™s no doubt that it can be useful, but potential doesnâ€™t mean that the potential will be leveraged.
Simon Levermann, mentioned last week for having released
pwhash, wrote up an article for the channel blog detailing its use and reason for existing. Thank you, Simon!
Scala is in a complex fight to overthrow Java, from DZone. Is the author willing to share the drugs they’re on? Scalaâ€™s been getting a ton of public notice lately – itâ€™s like the Scala advocates finally figured out that everything Scala brought to the table, Kotlin does better, and with far less toxicity. If kotlin wanted to take aim at Scala, thereâ€™d be no contest – Kotlin would win immediately, unless â€œused in Spark and Kafkaâ€ were among the criteria for deciding a winner. Itâ€™s a fair criterion, though, honestly; Spark and Kafka are in fairly wide deployment. But Scala is incidental for them, and chances are that their developers would really rather have used something a lot more kind to them, like Kotlin, rather than Scala.
More of the joys of having a super-rapid release cycle in Java: according to a post on the openjdk mailing list, bugs marked as critical are basically being ignored because the java 9 project is being shuttered. Itâ€™s apparently on to Java 10. This is going to take some getting used to. Itâ€™s good to have the new features, I guess, after wondering for years if Java would get things like lambdas, multiline strings, and so forth, but the rapid abandonment of releases before we even have a chance to see widespread adoption of the runtimes isâ€¦ strange.
James Ward posted Open Sourcing â€œGet You a Licenseâ€, about a tool that allows you to pull up licenses for an entire github organization – and issue pull requests that automatically add a license for the various projects that need one. Brilliant idea. Laziness is the brother of invention, thatâ€™s what Uncle Grandpa always said.
Welcome to the thirteenth ##java podcast. Itâ€™s Tuesday, January 30, 2018. Your hosts are Joseph Ottinger (dreamreal on IRC) and Andrew Lombardi (kinabalu on IRC) from Mystic Coders. We have a guest this podcast: Cedric Beust, whoâ€™s always been very active in the Java ecosystem, being a factor in Android and author of TestNG as well as JCommander and other tools – and it’s fair to say that if you’ve used modern technology, Cedric’s actually had something to do with it. Really.
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-13â€.
A topic of discussion from ##java last week centers on code coverage: what numbers are “good”? What numbers can be expected? What’s a good metric to consider? Joseph likes (apparently) absurdly high numbers, like 90% or higher; Cedric recommends 50% code coverage as a good baseline; Andrew targets 70%. Expect a poll in the channel on this! It’s a really good discussion, but it’s not really going to be summarized here; listen to the podcast!
Grizzly – an HTTP server library based on NIO – has been donated to EE4J. Thatâ€™s not particularly interesting in and of itself, but thereâ€™s a question of whether all the projects being donated to EE4J imply an abandonment of Java EE as a container stack. It may not be; after all, EE4J is an umbrella just like Java EE itself is, so this may be very much what we should expect – which makes pointing it out as news rather odd. (The original item was from Reddit.)
Pivotal gave us a really interesting article, called â€œUnderstanding When to use RabbitMQ or Apache Kafka.â€ Kafka and RabbitMQ are both sort of message-oriented, but thereâ€™s a lot of confusion about when youâ€™d use one against the other; this article discusses both RabbitMQâ€™s and Kafkaâ€™s strengths and weaknesses. It would have been nicer to talk about AMQP as opposed to RabbitMQ, but the article works nonetheless. Kafka is a high-performance message streaming library; itâ€™s not transactional in the traditional sense; itâ€™s incredibly fast. AMQP is slower (but still really fast, make no mistake) and provides traditional pub/sub and point to point messaging models. The main point of the article, though, is that if you need something other than a traditional model, Kafka is there… but itâ€™s going to involve some effort.
Gradle 4.5 has been released. Itâ€™s supposedly faster than it was, and has improvements for C/C++ programmers. It also has better documentation among other changes; Gradleâ€™s good, and this release is important, but itâ€™s not earth-shattering. This discussion veered off quickly and sharply to Cedric’s homegrown build tool, kobalt – and mentioned Eclipse’ Aether library, since migrated to Apache under the maven-resolver project.
More Java 9 shenanigans: Java EE modules – including CORBA, specifically – arenâ€™t part of the unnamed module in Java 9. This comes to us courtesy of InfoQ, which pointed out CORBA specifically – CORBA being harder to reach isnâ€™t really a big deal, Iâ€™d think, because nobodyâ€™s intentionally dealt with it who hasnâ€™t absolutely had to. And itâ€™s not really a Java EE module, really, so pointing out the removal along with Java EE is accurate but misleading. What does this mean? Well, if youâ€™re using one of the nine modules removed, youâ€™re likely to have to include flags at compilation and runtime to make these modules visible for your app. (See http://openjdk.java.net/jeps/320 for the actual Java Enhancement Proposal.)
Thereâ€™s a Java Enhancement Proposal for multiline strings. Itâ€™s in draft, but has Brian Goetzâ€™ support; this is one of those features that Java doesnâ€™t have thatâ€™s left people wondering why for a long time, I think – every other JVM language seems to include it. This doesnâ€™t come up very often – if it was actually all that critical it would have been done a long time ago – but itâ€™ll be nice to see it when (and if) it does make it into Java. Itâ€™s done with backticks; it does not use interpolation. Interesting, though.
Baeldung has an article called â€œThe Trie Data Structure in Java,â€ which, well, presents a Trie. Itâ€™s a good article, and explains the data structure really well – but doesnâ€™t explain why youâ€™d use a Trie as opposed to some other similar data structures. Tries represent a tradeoff between data size and speed; Tries tend to be incredibly fast while being more memory-hungry than some of their counterparts. Incidentally: there’s a question of pronunciation! “Trie” is typically pronounced the same was as “tree” is – while Joe pronounces it like “try” and struggled mightily to concede to peer pressure and say “tree.” Naturally, he was inconsistent about it; early pronunciation was in fact like “try” but, as stated, convention says “tree.” And it is a tree structure…
Simon Levermann, sonOfRa on the channel, published a reference to his new pwhash project, a result of a series of discussions that seem to have gone on for a few weeks on the channel. Itâ€™s a password hashing library; it provides a unified interface to a set of hashing algorithms, like argon2 and bcrypt.
Welcome to the twelfth ##java podcast. Your hosts are Joseph Ottinger, dreamreal on the IRC channel, and Andrew Lombardi (kinabalu on IRC) from Mystic Coders. Itâ€™s Tuesday, January 23, 2018.
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-12â€.
Not an “interesting link,” but we discuss data formats – JSON, XML, HOCON, YAML, Avro, protobuff, Thrift…
Java 9.0.4 has been released, as part of the scheduled January update. NOTE: This is the final planned release for JDK 9. This is scary; see also Azulâ€™s post, â€œJava: Stable, Secure and Free. Choose Two out of Three,â€ which points out that with Javaâ€™s new rapid-release schedule, youâ€™re going to have to be out of date, insecure, or financially on the hook to â€¦ someone to keep up with security releases. Weâ€™ve been wanting new features in Java for a long time; weâ€™ve been wanting more churn in the JVM, too. Looks like we, as an ecosystem, might get to experience what Scala goes through every few months, except at least we have the option of stability somewhere.
Speaking of Scala, we have â€œ10 reasons to Learn Scala Programming Language.â€ It actually has some decent points to makeâ€¦ but makes them with Scala. Thatâ€™s dumb. Thereâ€™s nothing that Scala really offers you that Kotlin doesnâ€™t, and thatâ€™s assuming Java 8 and Java 9â€™s improvements donâ€™t turn your crank themselves. Itâ€™s almost got a point with Spark and Kafka (well, it mentions Spark, Play, and Akka, and Iâ€™m going to pretend that the author meant to say â€œKafkaâ€ instead), butâ€¦ when thatâ€™s your real lever for learning a language, itâ€™s time to admit that the language was a mistake.
DZone: â€œJava 8: Oogway’s Advice on Optionalâ€ is yet another attempt to justify
Optional in Java. It has a fair point to make: â€œOptional is not a replacement for the null check. Rather, it tries to tell the caller about the nature of the returned value and implicitly reminds the caller to handle the absent cases.â€ But â€¦ okay. So what? In the end, you still have to write what is effectively pretty simple code, and adding the semantic turns out in practice to mostly add noise to your code without actually making it any better.
DZone: â€œAn Introduction to Hollow Jarsâ€, which I found fascinating but I donâ€™t know why. A â€œhollow jarâ€ is apparently a deployment mechanism where you have two deployable components: the main one, the â€œhollow jarâ€ basically has the other component – which is the actual application code – in its classpath, and serves to invoke the entry point of the application. The invoker would theoretically change very rarely, and therefore could be baked into a docker image or some other base image, and the component that changes more often would be soft-loaded at runtime.
Welcome to the eleventh ##java podcast. Iâ€™m Joseph Ottinger, dreamreal on the IRC channel, and itâ€™s Tuesday, 2018 January 16. Andrew Lombardi (kinabalu on IRC) from Mystic Coders is also on the podcast, and this episode has a special guest, Kirk Pepperdine from Kodewerk.
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-11â€.
This podcast has a lot to say about Meltdown, courtesy of Kirk – whoâ€™s a performance expert and one of the people you go to when you really need to figure out what your Java application is doing. The short version is this: Meltdown and Spectre are going to affect everything, due to the way modern CPUs work (listen to the podcast to figure out why – itâ€™s fascinating!) – and Javaâ€™s reputation as the environment where you can code and let the JVM magically fix everything for you may be in danger. Intel may have revived the importance of data structures for the JVM singlehandedly – not a bad thing, necessarily, but something Java programmers might have to get used to again.
Kirk also went into the things that make Java 9 worth using – and itâ€™s not modules. Itâ€™s the extended APIs and the packaging support, neither of which get mentioned very much because of all the chatter about modules.
The interesting links for this week:
DZone has been putting out a lot of information regarding Java 9â€™s modules. Up first is â€œJava 9 Modules Introduction (Part 1)â€œ, which does a pretty good job of walking through Java 9 modules from the basics on up. Itâ€™s all command-line based, so no IDE, no Maven, no Gradle – Part 2 promises integration with tooling. But knowing what the tools do is important, so this article is a good introduction, about as good as any other so far.
Another entry from DZone on Java 9 is â€œJava 9 Module Servicesâ€, which could be written to be more clear – it refers to a source repository instead of showing lots of relevant code – but does walk through the old ServiceLoader stuff and then walks through the same mechanism in Java 9.
Speaking of tooling: Baeldung has done a walkthrough of docker-java-api, providingi a guide to a Java client that interfaces with the Docker daemon, providing programmatic management of images, volumes, and networks.
Thereâ€™s also resilience4j, a fault-tolerance library inspired by Netflix Hystrix.It provides features for limited retries, transaction management, a number of other such things; I havenâ€™t run into a situation where Iâ€™ve needed this (transaction management has been enough, generally) but it looks like it might be useful; maybe Iâ€™ve made architectural decisions that allow me to avoid using libraries like this because I didnâ€™t want to write the features myself. Maybe if Iâ€™d known about this, my choices would be differentâ€¦ hard to say.
Lastly, thereâ€™s little-java-functions, a collection of functions that look pretty useful, although not modular at all. This library covers a lot of ground. The lack of modularity probably works against it; since weâ€™ve mentioned Java 9 so much, itâ€™d be nice if it mentioned Java 9 compatibility with modules, but maybe Java isnâ€™t prepared to go that far down the Scala rabbit-hole yet. In the process of recording this, a potential problem with licenses came up – possibly the subject of a future conversation – and the author ended up explicitly licensing the code under Creative Commons, thanks to Andrew.
Welcome to the tenth ##java podcast. If we were Neanderthals, our lives would be half over by now. As usual, I think, Iâ€™m Joseph Ottinger, dreamreal on the IRC channel, and itâ€™s Tuesday, 2018 January 9. Andrew Lombardi, kinabalu on IRC from Mystic Coders is with me again.
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-10â€. The podcast can also be found on iTunes and Iâ€™m trying to figure out if itâ€™d be worth it to put it on Youtube, too â€“ sorry, folks, no video from me. I canâ€™t afford the cameras; every time they take a picture of me, they shatter.
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.
TechTarget finally gets into the podcast, with Four ways the container ecosystem will evolve in 2018. Kubernetes gets the nod of approval, and… imagine containers being used in IoT. Iâ€™m not quite sure how the latter point will work. Is docker communicating with an embedded device, or are they talking about embedded devices RUNNING docker? If so, thatâ€™d be challenging. After all, Javaâ€™s not been all that successful on constrained devices either, and it has a constrained version. (The other two ways are: increased WIndows adoption in containers, and LinuxKit – derived from the Windows thing.)
Meltdown and Spectre – scary words indeed, and deservedly so. Our benefactors at Intel, whose sponsorship weâ€™d accept mostly because weâ€™re cheap and will take money from ANYONE, have blessed us with horrible security in virtually every chip manufactured in the last decade or so. Meltdown allows a program to access the memory of other programs and the host OS; Spectre also breaks isolation between programs. Fixing this requires replacing your physical CPU or patching your OS; the patches have performance implications. If youâ€™re not patched, start looking for patches today. The JVM is not a good vector for delivering either of these flaws, although yawkatâ€™s been playing around with trying it out; this is not the same as the JVM protecting you from other programs exploiting these flaws. Again, thanks, Intel.
Riccardo Cardin wrote up â€œSingle-Responsibility Principle Done Right on DZone. Heâ€™s addressing one of the SOLID principles from Robert Martin, the â€œSingle Responsibilityâ€ principle, which states: â€œA class should have only one reason to change.â€ Mr. Cardin understandably says that thatâ€™s a qualitative assertion and not a quantitative assertion – and he suggests adding cohesion to the definition, so that â€œonly one reasonâ€ means that it has a single purpose – be it serving as a rectangle, or interacting with a database, or what-have-you. Thatâ€™s still qualitative, really, but itâ€™s a good baseline – a data access object should ONLY interact with a database, not perform calculations on the individual objects (although I guess you could bend the definitions to make THAT work, too, in the case of reporting.)
Lorenzo Sciandra wrote up â€œI thought I understood Open Source – I was wrong,â€ a well-written post about the open source mindset. He says that he used to see open source as a customer getting a freebie: the maintainers have a product that they give freely to the world. But thatâ€™s wrong: open source is all about participation. As soon as you use an open source product, you yourself are an actual owner, even if youâ€™re passive about it; itâ€™s yours, not theirs, and you have a right (and to a degree a responsibility) to participate and contribute to that product. Itâ€™s yours. You bit it, you bought itâ€¦ which means if you find a problem, itâ€™s your responsibility to report and address it.
DZone offered us â€œA Log Message is Executable Code and Commentâ€. Basically, the author – Dustin Marx – suggests that using a logger for comments actually is a lot more useful than simple code comments; code comments are easy to ignore (even if your IDE highlights them, you get used to seeing the green or blue marker and just skip over them). But a logger event – especially if the log levels are high enough to not hide, like error or severe levels – isnâ€™t something you can ignore. The danger here, of course, is that your comments can actually affect your runtime; interpolation takes time, so you may end up having guards around your comments, a concept Iâ€™m struggling with. But itâ€™s a neat idea – if the logger uses a lambda instead of an interpolated value (the lambda can do the interpolation, after all) the logger can do its own guarding and the performance impact MIGHT be minimal.
Up next: JaVers compared to Envers. This is a comparison between JaVers and Envers. Both are auditing tools for databases, but they have very different mindsets; Envers stores in an â€œauditâ€ table that shows the history of the data with an additional version number, while JaVers stores a JSON representation of the object. The articleâ€™s pretty well-done – and uses Groovy to show functionality. Who knew – people use Groovy for something outside of Gradle? Crazy. Given that the article was written by the author of JaVers, I canâ€™t say it was completely unbiased. It looks like a decent write-up of both tools, and seems like a fairly useful tool if you itâ€™s a requirement for you. Have you needed to use any data auditing tools like this before?
head object and a
body object, and your
body would have a list of
paragraph objectsâ€¦ so youâ€™re just building an object model of an HTML page. It was slaughtered, and badly and quickly, by templating.)
â€œSwitch Expressions coming to Java?â€ mentions a Java enhancement to make
switch an expression instead of a statement. Iâ€™m all for this, but why limit it to
switch? Why not
if? This is one of those features that made me love Scala – before I realized what a puddle of hacks Scala was in the real world – and makes me enjoy Kotlin today. Itâ€™d be interesting to see how this works out – there are semantics that need defining, especially in light of backward compatibility – but I love this idea.
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
Set does). 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
Optional everywhere 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
print method.” Nowadays, if youâ€™re not working with Objective C, that sounds a little quaint, I think, but itâ€™s still a way of thinking about data flow. The article is suggesting that Kay – who questioned the analogy – was absolutely right when you think about the objects in question being representative of modules rather than finely-grained objects. With Java 9 supporting module granularity, who knows – this analogy may be back in vogue when people really start using Java 9 modules in practice.
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.
Welcome to the eighth ##java podcast. Iâ€™m Joseph Ottinger, dreamreal on the IRC channel, and itâ€™s Thursday, 2017 December 20. Andrew Lombardi from Mystic Coders is with me again.
Please donâ€™t forget: this is your podcast, with your content too. You can contribute by using a carrier pigeon and sending us notes encoded with rot13 – twice if you want to be really secure – or by using javabot on the IRC channel, with ~submit and an http link, or you can also write content for the channel blog at javachannel.org, or you can even just tell us that somethingâ€™s interestingâ€¦ weâ€™ll pick it up from there.
“Non-Blocking vs. blocking I/O: Go with blocking.” is an article by ##javaâ€™s surial. In it, heâ€™s talking about asynchronous code, especially with respect to I/Oâ€¦ and his assertion is that you really donâ€™t want to do it. If you decide you do (and there are reasons to) then you should at least rely on some of the libraries that already exist to make it easierâ€¦ but he mostly points out that it isnâ€™t worth it for most programmers. Interesting read, especially when you consider that Python and Node.JS live and die on this programming model.
“To self-doubting developers: are you good enough?” is an article meant to make you mediocre programmers feel better about yourselves. It talks about the processes and exercises that we all more or less had to go through to achieve competence. Itâ€™s not a long post, but it has some good points; programming is practice and art, just like athletics, really – and sometimes you lose, sometimes you plateau, sometimes you have to put in time that someone else might not have to put in. Sometimes the other guy is a natural at some things, and your effort is required to give you the edgeâ€¦ but the good news is that you can put in the effort.
Jason Whaley posted a link called “Incident review: API and Dashboard outage on 10 October 2017” that went into a Postgres multinode deployment failure. Itâ€™s a payments company, so the outage is a pretty big deal for them; the short form is that they had a series of failures at the wrong time, and the postgres installation failed. Thatâ€™s something we donâ€™t hear about very often – either because people are ashamed of it, or hiding it, or some other more nefarious reason, perhaps. More reasons why Iâ€™m a developer and not in DevOps? Some pretty in-depth analysis on multi-master Postgres and unintended consequences of architecture. Appears that aside from the Postgres-specific things mentioned here, it probably is a good idea to regularly introduce fault into your infrastructure to test it, to see where the problems are you didnâ€™t intend. And the automation erodes knowledge.
“Want to Become the Best at What You Do? Read this.” goes over five steps to being all that you can be including quoting â€œEye of the Tigerâ€ for added insult. Several of the ideas in here are valid though, focusing on improving your skills / self-improvement and putting yourself out there in a vulnerable way. All the items have a â€œThe Secretâ€ type of vibe around them though, which is a bit of a turn off. Love the process, better yourself, make a positive impact on the world, sounds pretty good.
A user on ##java posted a reference to zerocell – a simple open source library to read Excel spreadsheets into Java POJOs. Apache POI is the go-to for this, but POI is a little long in the tooth; itâ€™s always nice to see people creating new solutions. I donâ€™t have any Excel spreadsheets that I need converted into POJOs handy – and I donâ€™t think Iâ€™ve EVER had them… except maybe once.
“Understanding and Overcoming Coderâ€™s Block” is YET ANOTHER lifestyle article for this podcast; itâ€™s addressing those times when someone who might otherwise be a good coder – or writer, or anything – encounters the inability to write anything worthwhile. Itâ€™s focused on code, but itâ€™s pretty general even so: reasons include a lack of clarity on what youâ€™re trying to achieve, or a lack of decisiveness about how to solve a problem, or maybe the problem just seems too big to solve, or maybe even that youâ€™re just not all that jazzed about the project youâ€™re working on. It also addresses external factors – you know, real life – that might be getting in the way. Lastly, it includes some tips for each of those problems to perhaps point the way forward.
“The Myth of the Interchangeable Developer” is yet another lifestyle article that points out what we all know but that recruiters and managers seem to be ignorant about: we all have specific skillsets. If Iâ€™m a good services developer, it doesnâ€™t necessarily follow that Iâ€™m a good UI developer, for example… it doesnâ€™t mean that I canâ€™t learn, but it certainly implies that thereâ€™s an extra cost in time or aptitude for me to actually design a UI.
“Understanding Monads: a guide for the perplexed” is an article trying to explain monads yet again. Maybe itâ€™s me, but Iâ€™m thinking that monads might be one of those formal terms thatâ€™s useful but not useful enough, because theyâ€™ve been around forever but people still donâ€™t get them. Maybe thereâ€™s a giant set of programmers who shouldnâ€™t be allowed to program… but my feeling is that â€˜monadâ€™ is mostly jargon. To me itâ€™s a stateless bit of code that defers state elsewhere, so itâ€™s â€œfunctionally pure.â€ Lots of languages that rely on asynchronous programming have a similar concept, but they donâ€™t necessarily call them â€œmonadsâ€ (and they can store state elsewhere, too, so maybe theyâ€™re cheating.) Itâ€™s a decent article, but if you donâ€™t understand monads, it may not .. actually change anything for you. But maybe it will.
Ah, Project Valhalla. DZone has an article – pretty old now, actually, a month or two – that talks about Valhalla. No Valkyries, unfortunately, but value types instead: object references that are referred to just like primitives. This means that Java might get some forms of reification… but itâ€™s hard to say. The main thing I wanted to see from the article was more clear example code; thereâ€™s one that boxes an integer in a generic class, without specifying the integer type, but Iâ€™m not actually seeing where thereâ€™s a real benefit in code yet.
One of my favorite subjects is up next: “Why Senior Devs Write Dumb Code and How to Spot a Junior From A Mile Away.” Want to find a junior developer? Find someone who spends four hours tuning a bit of code that will run â€¦ once every four hours. Overexerting yourself trying to write the perfect bit of code every timeâ€¦ thatâ€™s a junior developer. Of course, we all know some senior developers who do the same sort of thingâ€¦ and we tolerate them, but itâ€™s just tolerance. I donâ€™t write supercomplicated code if I can help it, and Iâ€™d rather provide simple code to get something simple done if I can, even if that means Iâ€™m wasting a few hundred K of RAM or a few dozen milliseconds. I mean, sure, if we need those milliseconds or that RAM, we can tune for thatâ€¦ but we do that when necessary and not otherwise. A summary might be: hesitate to wax locquacious when your innate desire is to extrude tendrils for others to admire your skill; alternatively, allow their senses to inhale your greatness despite their inability to immediately perceive how impressive your capabilities are, especially in comparison to their own.