On Java 8’s introduction of Optional

I had recently discovered the JDK 8's addition of the Optional type. The Optional type is a way to avoid NullPointerException, as API consumers that get Optional return values from methods are "forced" to perform "presence" checks in order to consume their actual return value. More details can be seen in the Javadoc. A very … Continue reading On Java 8’s introduction of Optional

A Great Counter-Rant

Now, this is a great counter-rant, replying to one of my more popular articles: https://blog.jooq.org/the-golden-rules-of-code-documentation/ The counter-rant is given here: http://javax0.wordpress.com/2013/04/07/to-comment-or-not-to-comment-that-is-the-question The writer went through the trouble of actually implementing my fictional (but not unrealistic) example, which he's publicly displaying on GitHub: https://github.com/verhas/commentOrNotToComment (my fork, if the former was deleted) The code still doesn't communicate … Continue reading A Great Counter-Rant

The Lame Side of Java’s Backwards-Compatibility

Java is a very backwards-compatible language. Very as in very very very. It is so backwards compatible, we still have tons of deprecated code that was deprecated in the JDK 1.1. For example, most of the java.util.Date and java.util.Calendar API. Some may argue that it would've been easier to deprecate the classes altogether... But things … Continue reading The Lame Side of Java’s Backwards-Compatibility

A jOOX First-Time Experience Article

Here's some nice first-time user experience about jOOX, my lesser-known product: http://www.kubrynski.com/2013/03/as-developer-i-want-to-use-xml.html As a reminder, here's what jOOX is all about: jOOX stands for Java Object Oriented XML. It is a simple wrapper for the org.w3c.dom package, to allow for fluent XML document creation and manipulation where DOM is required but too verbose. jOOX only … Continue reading A jOOX First-Time Experience Article

How to Design a Good, Regular API

People have strong opinions on how to design a good API. Consequently, there are lots of pages and books in the web, explaining how to do it. This article will focus on a particular aspect of good APIs: Regularity. Regularity is what happens when you follow the "Principle of Least Astonishment". This principle holds true … Continue reading How to Design a Good, Regular API

Inadvertent Recursion Protection with Java ThreadLocals

Now here's a little trick for those of you hacking around with third-party tools, trying to extend them without fully understanding them (yet!). Assume the following situation: You want to extend a library that exposes a hierarchical data model (let's assume you want to extend Apache Jackrabbit) That library internally checks access rights before accessing … Continue reading Inadvertent Recursion Protection with Java ThreadLocals

Java Streams Preview vs .Net LINQ

I've started following this very promising blog by the "Geeks From Paradise". Apart from the fact that I'm a bit envious of geeks living in Costa Rica, this comparison of the upcoming Java 8 Streams API with various of .NET's LINQ API capabilities is a very interesting read. A preview of what you'll find there … Continue reading Java Streams Preview vs .Net LINQ

Will Java add LINQ to EL 3.0 in JSR-341?

This fact has somehow slipped by me unnoticed so far: As the JSR-341 websites claim, Java is going to add full .NET-Style LINQ support to its expression language 3.0! While the JSR-341 website doesn't explicitly mention these feature additions to the expression language, a lot of details can be seen here: http://java.net/projects/el-spec/pages/CollectionOperations This is very … Continue reading Will Java add LINQ to EL 3.0 in JSR-341?

Java Collections API Quirks

So we tend to think we've seen it all, when it comes to the Java Collections API. We know our ways around Lists, Sets, Maps, Iterables, Iterators. We're ready for Java 8's Collections API enhancements. But then, every once in a while, we stumble upon one of these weird quirks that originate from the depths … Continue reading Java Collections API Quirks

Hibernate, and Querying 50k Records. Too Much?

An interesting read, showing that Hibernate can quickly get to its limits when it comes to querying 50k records - a relatively small number of records for a sophisticated database: http://koenserneels.blogspot.ch/2013/03/bulk-fetching-with-hibernate.html Of course, Hibernate can generally deal with such situations, but you have to start tuning Hibernate, digging into its more advanced features. Makes one … Continue reading Hibernate, and Querying 50k Records. Too Much?