The regex that broke a server

Introduction I’ve never thought I would see an unresponsive server due to a bad regex matcher but that’s just happened to one of our services, yielding it unresponsive. Let’s assume we parse some external dealer car info. We are trying to find all those cars with “no air conditioning” among various available input patterns (but without matching patterns such as “mono air conditioning”).

A beginner’s guide to Git feature branches

Why Git The proprietary software shaped the Version Control Systems (VCS) to fit its requirements: the project has a strict release schedule the team is collocated the sprint goals are well-defined and the focus goes to a limited number of stories branching is usually reserved for releases or risky development features the centralized server is hidden from the outside world This is the context in which centralized Version Control Systems (e.g. Subversion) have emerged, but that’s not a good fit for open-source projects because: releases are not imposed by deadlines the contributors… Read More

JOOQ Facts: SQL functions made easy

Introduction The JDBC API has always been cumbersome and error-prone and I’ve never been too fond of using it. The first major improvement was brought by the Spring JDBC framework which simply revitalized the JDBC usage with its JdbcTemplate or the SqlFunction classes, to name a few. But Spring JDBC doesn’t address the shortcoming of using string function or input parameters names and this opened the door for type-safe SQL wrappers such as jOOQ. JOOQ is the next major step towards a better JDBC API and ever since I started using it… Read More

Code review best practices

Code review is a great software instrument and you should definitely use it to improve the quality of your code. But like any other tool, it may be misused sometimes. That’s why I came up with a list of best practices to guide you when reviewing your peers’ code. Code review is not testing: Code review is a developer-to-developer business and it doesn’t involve any testing. Code review should check if the task requirements are met in the cleanest possible way. You don’t tell what to code review: The same way you… Read More

How to detect the Hibernate N+1 query problem during testing

Introduction In this article, you are going to learn how to automatically detect the N+1 query problem when using JPA and Hibernate using the Hypersistence Utils open-source project. With Hibernate, you manage entity state transitions, which are then translated to SQL statements. The number of generated SQL statements is affected by the current fetching strategy, Criteria queries, or Collection mappings, and you might not always get what you expected. Ignoring SQL statements is risky, and it may eventually put a heavy toll on the overall application performance. I’m a strong advocate of… Read More