Storytelling with tests #1: test names and granularity

Very often you can hear that automated tests provide a great documentation of the production code. Such documentation is more fun to write and is always up to date (of course as long as you actually run your tests). A new developer may take a look on the tests to get familiar with the project. … Continue reading "Storytelling with tests #1: test names and granularity"

Read More

When more is less: mind the cacheability

There are many guidelines and patterns for optimizing performance of web applications. I would like to address and confront one of them: minimizing the number of database queries (or web service calls) per request. It sounds like a good heuristic – each network round-trip (e.g. to and from the DB) takes several milliseconds and impacts the overall response time. So having fewer queries is indeed the right approach for many cases. However, I would like to highlight some situations, when better way is to do the opposite.

Read More

Undoing in Git

Git is probably the most popular distributed version control system. When used properly, it allows a team to be extremely effective. When misused, it can create a total mess out of the code base. Every now and then you end up in a situation, when you have to undo your actions — it can include invalid file edits or deletions or even improperly executed Git commands.

Read More

Automated validation of DB schema migrations

Object Relational Mapping frameworks, such as Hibernate, very often provide a way to automatically generate the database schema based on persistent classes. While it is very convenient as a proof of concept or for very simple applications, it is not a production ready approach. In reality you have to write scripts to version your schema … Continue reading "Automated validation of DB schema migrations"

Read More

Effective RESTful search API in Spring

Flexible RESTful search is very often a must-have for a web application. While the concept is easy and not new, it is very often implemented in a repetitive and tedious way. In this post I will demonstrate an effective way of implementing search API with Spring Data and Specification Argument Resolver. Naive approach With Spring … Continue reading "Effective RESTful search API in Spring"

Read More