Menu

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

Parallelizing JUnit test runs

February 20, 2010

Test runs should be as fast as possible in order to allow a lean development cycle. One of the applications is a Continuous Deployment (see Lean Startup). Using strong multi-core machines to run tests is not enough since most unit tests are using a single thread per test. Apart of reducing IO to minimum, having… Read more

select product(value) from mytable

February 12, 2010

A nice tip from Harold Fuchs to calculate the product in Mysql select exp(sum(log(coalesce(value,1))) from mytable The coalesce() function is there to guard against trying to calculate the logarithm of a null value and may be optional depending on your circumstances. Here’s an example +——+——-+ | id | value | +——+——-+ | 1 | 3… Read more

Voldemort in the Wild

February 02, 2010

At kaChing, we’ve tried to embraced as much of the lean startup methodology as possible. In keeping with the spirit, we’ve worked to scale our infrastructure smartly, using data to drive our decisions and discarding speculation. As part of our infrastructure, we’ve embraced Project Voldemort as a highly performant and reliable data store. One experiment… Read more

Amusing log message

January 26, 2010

Some of us found this (a little too) amusing: [pool-http-jetty-exec-thread-3] 20100122140052,WARN,com.kaching.trading.core.BalanceCalculation$1, missing price for stock AAGH on portfolio [elided] com.kaching.trading.core.StockMissingException: AAGH @ 01/22/2010 at com.kaching.trading.core.PositionMetrics.getPositionValues(PositionMetrics.java:265) at com.kaching.trading.core.PositionMetrics.getLongPositionValues(PositionMetrics.java:251) at com.kaching.trading.core.PositionMetrics.getAggregateLongValue(PositionMetrics.java:274) at com.kaching.trading.core.PositionMetrics.getTotalValue(PositionMetrics.java:286)

Complement TDD with MDA

January 10, 2010

Test Driven Development (aka TDD) is on the rise. Good developers understand that code with no proper testing is dead code. You can’t trust it to do what you want and its hard to change. I’m a strong believer in Dijkstra’s observation that “Program testing can be a very effective way to show the presence… Read more