Menu

Elsewhere: Next Generation Java Programming Style

July 21, 2010

Vlad sent around a very good article on good Java coding style, which we all liked. Most of the suggestions are exactly what we do here, with a heavy functional influence on our Java code. A sample: Final is your new love: More and more Java developers in the teams I’ve worked with, started to… Read more

Entities and Values

May 04, 2010

In object-oriented programming, defining new classes of objects is the typical way of introducing new types. It is extremely important to classify these types in order to ensure separation of concerns. In this article, I am going to define two common classes of types, namely entities and values. Entities are objects of the domain model,… Read more

Ids and Ambiguous Method Parameters

March 14, 2010

You’ve probably run into a method with a signature like: void addToGroup(long userId, long groupId) and a common question you might ask yourself is, “Oh, was it the user id first, or the group id first? I always forget. Stupid method.” You’ve encoded the meaning of the parameters into their names, and hence you need… Read more

Easy to get burned by Hibernate

October 22, 2009

I got burned by Hibernate the other day. This code throws a ClassCastException; can you see what the trouble might be? return (Integer) session.createSQLQuery( “select count(*) ” + “from trades ” + “where date >= :from and date < :to”) .setParameter(“from”, converter.toString(from)) .setParameter(“to”, converter.toString(to)) .uniqueResult(); Under the covers Hibernate infers the result of the query… Read more

Unifying Type Parameters in Java

October 12, 2009

At kaChing, we’ve designed from the ground up using services. We have many servers clustered into services which respond to simple queries such as “give me Alice’s watchlist”, “buy 10,000 shares of Google for Ted” and quite often “give you $10M for inviting a friend”. At the lowest level in our platform, we’ve decomposed our… Read more