In many (JPA) applications numerical ids are chosen for the surrogate key of the entities. But how do we make sure that they are not used twice? In a scenario where our application needs to scale horizontally we need a solution for that. Most developers come to the conclusion that the database should take care of that. But this is a fragile solution and in this article I want to discuss it.
Did you work on the task to integrate Spring Security in a project? If yes you probably stumbled upon the decision which PasswordEncoder to use. I saw many developers actively researching that question and deciding on a concrete algorithm. In one project we even choose a less secure decoder - for performance reasons. Don’t. Just don’t! Don’t choose a weak encoder for performance. Actually, don’t choose at all! Let Spring handle your security.
Personal development goals in software engineering are not trivial to define. In general, goals should be SMART (Specific, Measurable, Achievable, Realistic and Timely). But in reality our field of expertise is that diverse and complex that it is not as easy to find those goals like in other professions. For someone working in the sales department a revenue goal is easy to define and to decide whether he succeeded or not.
JPA entities have a couple of pitfalls and consequences when handling them in your application. Especially understanding how JPA manages and synchronizes the state of an entity is essential to avoid unexpected behavior. This can be unintuitive when passing JPA entities as method parameters in Spring Data in- and outside a transaction. In this post I will explain a best practice when working with JPA entities and when it’s okay to pass it through method parameters and when you should avoid it.
In recent reviews I stumbled upon extension functions which didn’t quite felt right, but I wasn’t able to determine where that gut feeling was coming from. After seeing quite a lot of them I came to some conclusions why that’s the case, and I gathered rules for me when extension functions make sense to use and when they should be avoided. I discovered an overuse of the language feature - something you often experience when you work with a new fancy language with nice features.