Encrypting using gpg from Java

February 23, 2011

Recently, we worked with a third-party that had trouble reading files encrypted using the Bouncy Castle’s OpenPGP implementation. We ended up deciding to rely directly on the GNU Privacy Guard’s OpenPGP implementation. As I didn’t find any working example on the web, I figured that the following piece of code might end up being useful… Read more

Expressive Java & Fluent Interfaces

December 15, 2010

In this article I briefly explore Wealthfront’s extensive usage of expressive and fluent interfaces in Java such as Kawala, Guice, Mockito, and Guava. To the uninitiated, Java invokes parables of moronic XML, obtuse syntax, and Nile-like constructor calls. As a result, Java’s status as a living language is often questioned and it’s “uncoolness” is dogmatically… Read more

Trust, but Remind

December 06, 2010

Every engineering organization faces the problem of how to ensure that things are done right. At Wealthfront, our appoach is a safety net of extremely thorough automated testing that guides the engineer to do the right thing. Automation is consistent. It doesn’t skip a code review because we’re in a hurry. It doesn’t fail to… Read more

Circular dependencies between entities

November 29, 2010

One question I am often asked is how to handle circular dependencies between Hibernate entities. Interestingly enough, the answer that people are usually looking for ends up being to a slightly different question; namely, how to handle circular dependencies between entities. Let’s have a look at an example. Consider two entities, Customer and Account, with… Read more

Less IO for your Unit Tests with a Java SecurityManager

November 11, 2010

Our quest for a truly test-driven engineering team has enabled us to confidently ship our software every few minutes. Automated testing is the keystone of continuous deployment, and as a result our unit tests and smoke tests are thorough. Perhaps, a bit too thorough. (Our last unit testing extravaganza in the form of a cyclomatic-complexity-driven… Read more

Computation: “There is no try”

November 09, 2010

Often a complex, multi-step calculation requires your code to react to many circumstances. Typically you use exception handling to separate the normal control flow from error handling: Option<BigDecimal> result = Option.none(); try { result = compute(); } catch (WhateverException e) { // Perhaps rethrow. } if (result.isEmpty()) { // Perhaps retry, or set a dummy… Read more