New Site Built with Hugo

I just rebuilt using Hugo, docker, and a variety of other goodness.

I chose not to port over a variety of old content, and I also chose to not worry about feed links to RSS and such. Please review your RSS feeds if you happen to still be following this blog.

Is There Curry In This Dish?

Now that Java is dipping its toes into the waters of supporting functional programming styles, many of the tenets of functional programming come to mind, and it’s worth exploring what is possible in this brave new world. Two of those features are currying and partial application. So the question is, can Java be functional? Currying and Partial Application - A Refresher Currying (named after Haskell Curry) is the process of generating function invocations with multiple parameters via single-parameter functions that return follow-up functions. [Read More]

Understanding Method References

Java 8 introduces four types of method references: Static - Converts any static method into a lambda with matching formal parameters. Instance-Capturing - Converts a method call on a specific object into a lambda. Constructor - Converts constructors into factory lambdas for a specific type. Arbitrary Instance - Converts a method on all instances of a type into a lambda that accepts instances of that type. Since method references apply more magic behind the scenes than straight lambdas, I thought it might be good to walk through each with examples from the pre-lamdba Java world on each: [Read More]

The Increased Importance of Generic Exceptions in API Design

One of the more interesting things with Java 8 will be how it impacts the way API design is done. This is already being discussed a lot with lambdas, and indeed, they are the key driver for much of the API change. However, it’s not as simple as making sure you accept single method interfaces everywhere. There are a lot of subtle changes to consider. I will walk through one here with exceptions. [Read More]

Bi-Directional References in Google App Engine with ID Pre-Allocation

It’s not uncommon when dealing with any database that you’ll occasionally have records where you need to navigate both from A to B, and from B to A - aka bi-directional relationships. In cases where your database is generating your IDs for you, you have a chicken-egg problem; to insert both records and establish the link at-once isn’t generally possible, as only one of the records will have a generated ID ready in time. [Read More]
gae  gcs  objectify  java 

Objectify Entity Subclass Migrations

If you’re using Google App Engine with Java, chances are good that you’re using Objectify. While Objectify 4.0 final is not technically released, the release-candidate has been available for some time, and has shown to be quite stable. Unlike with a relational database, the generally preferred way to migrate data in a NoSQL datastore where you may have terabytes of data is gradually, and on an as-needed basis. Typically this manifests in two potential ways, either: [Read More]

Media Temple Makes a Deal with the Devil

Today, Media Temple announced that they are being acquired by GoDaddy. Here’s a tip for Media Temple: if you have to spend your entire FAQ trying to convince folks that the acquisition isn’t a bad idea… maybe it actually is a bad idea. But surely, that’s not enough reason to switch hosts. It seems silly to move, just because of an acquisition that Media Temple has said so strongly won’t affect their service: [Read More]

Reclaiming the Underscore

Java, as a language, has historically been quite careful to avoid changes that are forwards-incompatible. This is quite obvious to anyone who has spent any time coding against the JVM. Very few changes come in that don’t allow for applications migrate forward naturally. There seem to be different tiers of protection here, with the first being binary compatibility. Ideally, applications compiled with Java 1.4 will still run on JVMs today, which says a lot. [Read More]
java  java8  jdk8 

JEP-171: Fence Intrisics Keep Memory In Line

Doug Lea just posted a new Java enhancement proposal with JEP-171 - Fence Intrinsics. This enhancement is all about exposing memory fence controls into Java code so that the java.util.concurrent APIs can more accurately and efficiently control memory ordering and bounding. This is an interesting JEP as it proposes no Java consumer-oriented APIs; the only changes would be on the sun.misc.Unsafe class - which is already a fascinating pivot point for many of the advanced concurrency features of Java. [Read More]