donroby.blogspot.com
onChange: Testing with an in-memory Database
http://donroby.blogspot.com/2008/01/testing-with-in-memory-database.html
Thursday, January 3, 2008. Testing with an in-memory Database. Persistence tests are slow, and hard to make repeatable. The repeatabity problem is primarily in dealing with setup to a known state and/or teardown to return to a known state. Even if you do write setup and teardown to put data into the DB and remove it, things like automatically generated ids are somewhat painful to reset so that the next run generates the same ones again. Public Connection getConnection() throws Exception {. You might want...
donroby.blogspot.com
onChange: Functional Adventures in Java
http://donroby.blogspot.com/2007/12/functional-adventures-in-java.html
Tuesday, December 25, 2007. Functional Adventures in Java. For a start, Haskell can handle infinite lists, and some interesting infinite lists occurring in math can be defined quite succinctly, as in:. Sieve (x:xs) = x:sieve [y y -xs, (y `mod` x) /= 0]. Primes = sieve [2.]. I'm not ready to create enough syntactic sugar to make Java code for an infinite list of prime numbers quite that concise, but support for infinite lists would be nice. After a bit of struggling to fit these ideas to Java's Collection.
donroby.blogspot.com
onChange: Code Style Choices
http://donroby.blogspot.com/2008/07/code-style-choices.html
Friday, July 4, 2008. During a recent job interview, I was asked to code on a whiteboard a merge function for two lists of integers assumed to be sorted. I stumbled around a bit, coding and explaining, and ended up with a very messy whiteboard, but apparently did ok, as they've asked me back for more interviews. Public static List Integer merge(List Integer list1,. List Integer list2) {. If (null = list1). If (null = list2). ArrayList Integer result = new ArrayList Integer ();. If (null = next1) {. List2...
donroby.blogspot.com
onChange: Refactoring Challenge
http://donroby.blogspot.com/2007/11/refactoring-challenge.html
Sunday, November 18, 2007. In a recent post. To the Test Driven Development yahoo group, Jeff Grigg posted a bit of a challenge, in the form of an uploaded file. With some code that looked like:. Public class LogicMatrix {. Public static void callTheRightMethod(boolean a,. TODO: Refactor this to be simple and obvious:. Else if (a &! Else if (a & b &! Else if (a &! Else if (a & b & c &! Else if (a &! Else if (a & b &! Else if (a &! Else if (a & b & c & d). This matrix was really a string:. The conditions ...
donroby.blogspot.com
onChange: onStart
http://donroby.blogspot.com/2007/11/onstart.html
Sunday, November 18, 2007. Maybe this post should be titled "Naming a Blog". I started this thing yesterday and wasn't happy just naming the blog for myself, but couldn't really think of a better name. So I went into a spin of up-front thinking. What's this for anyway? I guess I'll be writing about Agile Software Development. To reflect that. But no, too specific - I might use that for a post title later. I might even ramble about the Structure of Scientific Revolutions. Kent Beck's dictum "Embrace Chang...