jOOQ has been around for a while now (since 2009!) and by now we can say we've seen quite a bit of things about the SQL and Java languages. Some of our design decisions are particular in the way jOOQ thinks about programming with SQL. These include: Nullability (let's stop fighting it) Value types (let's … Continue reading 5 Things You May Not Have Known About jOOQ
jOOQ 3.10 Supports Exciting MySQL 8.0 Features
In recent months, there had been some really exciting news from the MySQL team: (Recursive) Common Table Expressions in MySQL Introducing Window Functions These two SQL standard language features are among the most powerful SQL features that are available from most other databases. I frequently include them in conference talks about SQL (see my article … Continue reading jOOQ 3.10 Supports Exciting MySQL 8.0 Features
A Curious Java Language Feature and How it Produced a Subtle Bug
Java's visibility rules are tricky at times. Do you know what this will print? package p; import static p.A.x; class A { static String x = "A.x"; } class B { String x = "B.x"; } class C { String x = "C.x"; class D extends B { void m() { System.out.println(x); } } } … Continue reading A Curious Java Language Feature and How it Produced a Subtle Bug
Don’t Overdo the “Principle of Least Astonishment” Cargo Cult
As we all agree, GOTO is evil, right? Relevant XKCD Or even funnier: New Intern Knows Best Of course, GOTO isn't evil Of course, somewhere deep down in our professional selves, we know that GOTO isn't evil, it's just a very basic processor instruction that was available since the early days of assembly code. GOTO … Continue reading Don’t Overdo the “Principle of Least Astonishment” Cargo Cult
Don’t Extract Everything Into a Method
Every now and then, I tweet something like this, just to piss off some clean coders: https://twitter.com/lukaseder/status/885498470542577673 Apart from the obvious trolling factor (why can't I ever resist?), I do think there's something thought provoking in such a tweet. First off, given how rare break and continue statements are in Java code, many people probably … Continue reading Don’t Extract Everything Into a Method
How I Incorrectly Fetched JDBC ResultSets. Again.
You know JDBC, right? It's that really easy, concise API that we love to use to work with virtually any database, relational or not. It has essentially three types that you need to care about: ConnectionStatement (and its subtypes)ResultSet All the other types some sort of utilities. Now, with the above three, we can do … Continue reading How I Incorrectly Fetched JDBC ResultSets. Again.
Are Java 8 Streams Truly Lazy? Not Completely!
Notice, this issue has been fixed in Java 8 (8u222), thanks for the comment Zheka Kozlov In a recent article, I've shown that programmers should always apply a filter first, map later strategy with streams. The example I made there was this one: hugeCollection .stream() .limit(2) .map(e -> superExpensiveMapping(e)) .collect(Collectors.toList()); In this case, the limit() … Continue reading Are Java 8 Streams Truly Lazy? Not Completely!
A Basic Programming Pattern: Filter First, Map Later
In recent days, I've seen a bit too much of this: someCollection .stream() .map(e -> someFunction(e)) .collect(Collectors.toList()) .subList(0, 2); Something is very wrong with the above example. Can you see it? No? Let me rename those variables for you. hugeCollection .stream() .map(e -> superExpensiveMapping(e)) .collect(Collectors.toList()) .subList(0, 2); Better now? Exactly. The above algorithm is O(N) … Continue reading A Basic Programming Pattern: Filter First, Map Later
ORMs Should Update “Changed” Values, Not Just “Modified” Ones
In this article, I will establish how the SQL language and its implementations distinguish between changed values and modified values, where a changed value is a value that has been "touched", but not necessarily modified, i.e. the value might be the same before and after the change. Many ORMs, unfortunately, either update all of a … Continue reading ORMs Should Update “Changed” Values, Not Just “Modified” Ones
jOOQ Tuesdays: Gerald Sangudi and Keshav Murthy Reveal the Secrets of N1QL (SQL on JSON)
Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other month where we interview someone we find exciting in our industry from a jOOQ perspective. This includes people who work with SQL, Java, Open Source, and a variety of other related topics. I'm very excited to … Continue reading jOOQ Tuesdays: Gerald Sangudi and Keshav Murthy Reveal the Secrets of N1QL (SQL on JSON)
