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
Defensive API evolution with Java interfaces
API evolution is something absolutely non-trivial. Something that only few have to deal with. Most of us work on internal, proprietary APIs every day. Modern IDEs ship with awesome tooling to factor out, rename, pull up, push down, indirect, delegate, infer, generalise our code artefacts. These tools make refactoring our internal APIs a piece of … Continue reading Defensive API evolution with Java interfaces
A dirt-ugly hack to modify private final fields in Java
We all use reflection from time to time. We may even tamper with visibility through Java's Field.setAccessible() and similar methods. But this post here takes things to the extreme and shows how to modify private (static) final fields in Java. Think twice, when choosing this tool ;-) http://zarnekow.blogspot.ch/2013/01/java-hacks-changing-final-fields.html
Bloated JavaBeans™, Part II – or Don’t Add “Getters” to Your API
I have recently blogged about an idea how JavaBeans™ could be extended to reduce the bloat created by this widely-accepted convention in the Java world. That article was reblogged on DZone and got quite controversial feedback here (like most ideas that try to get some fresh ideas into the Java world): http://java.dzone.com/articles/javabeans™-should-be-extended. I want to … Continue reading Bloated JavaBeans™, Part II – or Don’t Add “Getters” to Your API
Emulating the SQL standard derived column list
Derived column lists are a fine feature, if your database supports them. The SQL:2008 standard specifies 7.6 <table reference> <table reference> ::= <table factor> | <joined table> <table factor> ::= <table primary> [ <sample clause> ] <table primary> ::= <table or query name> [ [ AS ] <correlation name> [ <left paren> <derived column list> … Continue reading Emulating the SQL standard derived column list
A map of all those new NoSQL, NewSQL, post-SQL, structured, unstructured database options that came out over the past year
So you want to go with the flow and implement your next application on top of some NoSQL, NotJustSQL, NewSQL, AlmostSQL, SQL++, NextGenSQL, and what not, just to be sure not to miss out on some of the latest developments in the data business? Here's a little map to guide you through the jungle of … Continue reading A map of all those new NoSQL, NewSQL, post-SQL, structured, unstructured database options that came out over the past year
Row value expressions and the BETWEEN predicate
Now this is a simple example of how SQL clause simulation can get nasty if you want to make use of some more advanced SQL clauses that aren't supported in all databases. Consider the following predicate and equivalent transformations thereof: The BETWEEN predicate The BETWEEN predicate is a convenient form of expressing the fact that … Continue reading Row value expressions and the BETWEEN predicate
Row value expressions and the NULL predicate
Row value expressions are something very powerful in SQL. They have been around since the early days of standard SQL, e.g. in SQL 1992, even if not all databases implement them correctly, still today. As always, the NULL predicate is one that is a bit tricky to understand, also in the context of row value … Continue reading Row value expressions and the NULL predicate
JDEclipse: A must-have Java Decompiler
I have recently discovered this new, must-have Eclipse plugin, which is very useful for those third-party libraries whose source-code you can't easily find or link into your Eclipse: JDEclipse. It doesn't only decompile byte code into Java code, it does so extremely well, keeping line numbers at the correct place, such that you can actually … Continue reading JDEclipse: A must-have Java Decompiler
