How to Execute Something Multiple Times in Java

When writing unit / integration tests, you often want to execute something multiple times, with different configurations / parameters / arguments every time. For instance, if you want to pass a "limit" or "timeout" or any other argument value of 1, 10, and 100, you could do this: @Test public void test() { runCode(1); runCode(10); … Continue reading How to Execute Something Multiple Times in Java

The Golden Rules of Code Documentation

Here's another topic that is highly subjective, that leads to heated discussions, to religious wars and yet, there's no objective right or wrong. A previous post on my blog was reblogged to my blogging partner JavaCodeGeeks. The amount of polarised ranting this blog provoked on JCG is hilarious. Specifically, I like the fact that people … Continue reading The Golden Rules of Code Documentation

A Typesafety Comparison of SQL Access APIs

SQL is a very expressive and distinct language. It is one of the few declarative languages which are used by a broad audience in everyday work. As a declarative language, SQL allows to specify what we're expecting as output, not how this output should be produced. As a side-effect of this, ad-hoc record data types … Continue reading A Typesafety Comparison of SQL Access APIs

Duck Typing in Scala: Structural Typing

Scala goes very far with its loads of features improving the JVM world. Sometimes, a bit too far, maybe. But this feature here is just plain awesome! Typesafe duck typing! An example: def quacker(duck: {def quack(value: String): String}) { println (duck.quack("Quack")) } The above quacker method accepts any "duck" that can quack. Read the full … Continue reading Duck Typing in Scala: Structural Typing

Easy Mocking of Your Database

Test-driven development is something wonderful! Once you've established it in your organisation, you will start to: Greatly improve your quality (things break less often) Greatly improve your processes (things can be changed more easily) Greatly improve your developer atmosphere (things are more fun to do) The importance of doing the right test-driven development is to … Continue reading Easy Mocking of Your Database

jOOQ’s Reason for Being

The below paragraphs were taken from the jOOQ preface from the manual. It is worth thinking about why you should (or should not) use jOOQ in a given project. Specifically, you might be choosing between jOOQ and JPA, jOOQ and Hibernate, or jOOQ and SLICK (in a Scala context). here's some guidance (slightly biased towards … Continue reading jOOQ’s Reason for Being

Get hidden feature requests from your users

In general, I'm not a marketing guy, I prefer to develop code. But when I look at modern marketing tools that we developers have created for our marketing friends, I'm getting a bit jealous. Take this blog, for instance. It's the perfect jOOQ marketing tool. Check out my 2013 visitor statistics: Quite obviously, my February … Continue reading Get hidden feature requests from your users

Get a geeky jOOQ t-shirt or mug

Finally, I have created a web shop where you can buy t-shirts and mugs and other merchandise with jOOQ or jOOX logos on them. I have added a small provision of €12 to most articles. This won't get me rich, but it is an easy way for you to donate a little bit of money … Continue reading Get a geeky jOOQ t-shirt or mug

Java, if this were a better world

Just a little dreaming about a better world, where some old blunders in the Java platform would've been corrected and some awesome missing features would've been implemented. Don't get me wrong. I think Java is awesome. But it still has some issues, like any other platform. Without any particular order, without claiming to be anything … Continue reading Java, if this were a better world

Java trivia: the double-checked locking pattern

Some Java trivia: In most cases, it is sufficient to simply mark a lazy initialising method as synchronized. The following example can be found in the Wikipedia article about double-checked locking: // Correct but possibly expensive multithreaded version class Foo { private Helper helper = null; public synchronized Helper getHelper() { if (helper == null) … Continue reading Java trivia: the double-checked locking pattern