Do You Really Have to Name Everything in Software?

This is one of software engineering's oldest battles. No, I'm not talking about where to put curly braces, or whether to use tabs or spaces. I mean the eternal battle between nominal typing and structural typing. This article is inspired by a very vocal blogger who eloquently reminds us to ... [...] Please Avoid Functional … Continue reading Do You Really Have to Name Everything in Software?

SQL, Streams, For Comprehension… It’s All the Same

Recently, at Devoxx, I've seen this beautiful slide in a talk by Kevlin Henney https://twitter.com/lukaseder/status/796704785936293888 In his talk, he was displaying a variety of approaches to solve the FizzBuzz "problem", including a couple of very elegant solutions in completely declarative approaches and languages. In this particular slide, Kevlin used a notation that is derived from … Continue reading SQL, Streams, For Comprehension… It’s All the Same

Prevent SQL Injection with SQL Builders Like jOOQ

As long as we allow ourselves to write string-based dynamic SQL embedded in other programming languages like Java, we will have a certain risk of being vulnerable to SQL injection. That's a fact. Don't believe it? Check out this website exposing all vulnerabilities on Stack Overflow for PHP questions: https://laurent22.github.io/so-injections In a previous blog post, … Continue reading Prevent SQL Injection with SQL Builders Like jOOQ

Applying Queueing Theory to Dynamic Connection Pool Sizing with FlexyPool

I'm very happy to have another interesting blog post by Vlad Mihalcea on the jOOQ blog, this time about his Open Source library flexypool. Read his previous jOOQ Tuesdays post on Hibernate here. Vlad is a Hibernate developer advocate and he's the author of the popular book High Performance Java Persistence, and he knows 1-2 … Continue reading Applying Queueing Theory to Dynamic Connection Pool Sizing with FlexyPool

A Hidden jOOQ Gem: Foreach Loop Over ResultQuery

A recent question on Stack Overflow about jOOQ caught my attention. The question essentially asked: Why do both of these loops work? // With fetch() for (MyTableRecord rec : ctx .selectFrom(MY_TABLE) .orderBy(MY_TABLE.COLUMN) .fetch() // fetch() here ) { doThingsWithRecord(rec); } // Without fetch() for (MyTableRecord rec : ctx .selectFrom(MY_TABLE) .orderBy(MY_TABLE.COLUMN) // No fetch() here ) … Continue reading A Hidden jOOQ Gem: Foreach Loop Over ResultQuery

Using jOOλ to Combine Several Java 8 Collectors into One

With Java 8 being mainstream now, people start using Streams for everything, even in cases where that's a bit exaggerated (a.k.a. completely nuts, if you were expecting a hyperbole here). For instance, take mykong's article here, showing how to collect a Map's entry set stream into a list of keys and a list of values: … Continue reading Using jOOλ to Combine Several Java 8 Collectors into One

All Libraries Should Follow a Zero-Dependency Policy

This hilarious article with a click-bait title caught my attention, recently: https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558 A hilarious (although not so true or serious) rant about the current state of JavaScript development in the node ecosystem. Dependency hell isn't new Dependency hell is a term that made it into wikipedia. It defines it as such: Dependency hell is a … Continue reading All Libraries Should Follow a Zero-Dependency Policy

The Java JIT Compiler is Darn Good at Optimization

"Challenge accepted" said Tagir Valeev when I recently asked the readers of the jOOQ blog to show if the Java JIT (Just-In-Time compilation) can optimise away a for loop. Tagir is the author of StreamEx, very useful Java 8 Stream extension library that adds additional parallelism features on top of standard streams. He's a speaker … Continue reading The Java JIT Compiler is Darn Good at Optimization

“What Java ORM do You Prefer, and Why?” – SQL of Course!

Catchy headline, yes. But check out this Stack Overflow question by user Mike: (I'm duplicating it here on the blog, as it might be deleted soon) It's a pretty open ended question. I'll be starting out a new project and am looking at different ORMs to integrate with database access. Do you have any favorites? … Continue reading “What Java ORM do You Prefer, and Why?” – SQL of Course!

How Functional Programming will (Finally) do Away With the GoF Patterns

A recent article about various ways to implement structural pattern matching in Java has triggered my interest: http://blog.higher-order.com/blog/2009/08/21/structural-pattern-matching-in-java The article mentions a Scala example where a tree data structure can be traversed very easily and neatly using Scala's match keyword, along with using algebraic data types (more specifically, a sum type): def depth(t: Tree): Int … Continue reading How Functional Programming will (Finally) do Away With the GoF Patterns