Teaching is the best way to learn
Introduction Software development is all about knowledge, and nowadays the number of things a programmer needs to know skyrocketed. Most of the time developers are hired by matching their current skills with some project requirements. The project eventually ends, and the developer is assigned to a new project, sometimes using different technologies than what he was previously hired for. What’s the policy for training this guy to deliver his best the soonest possible? Usually, training and coaching are left-out, so each programmer is on his own. Every time we leave things to chance a huge… Read More
Why I never blame open source projects
Every now and then I get to read someone’s bad thought towards a given open-source framework. When I started programming Struts web framework was at its prime, everybody loved it. But then, little by little people started blaming it and then hate followed. Then people started blaming Hibernate and recently MongoDB. I’ve even read that “I shouldn’t use MongoDB“. Well, I delivered projects on Struts, Hibernate and MongoDB, and none of those was ever a blocker. If there is someone to blame it’s usually us, not the frameworks we use. If you… Read More
How to retry JPA transactions after an OptimisticLockException
Introduction In this article, I will discuss how we can implement an automatic Retry mechanism when dealing with the JPA OptimisticLockException. You can find the introductory part here and the MongoDB implementation here.
Optimistic locking retry with MongoDB
As I explained this article, there are many benefits of employing optimistic locking for MongoDB batch processors. The Spring framework offers very good AOP support and, therefore, makes it easy to implement an automatic retry mechanism that we can use for optimistic locking.
MongoDB optimistic locking
Introduction When moving from JPA to MongoDB you start to realize how many JPA features you’ve previously taken for granted. JPA prevents “lost updates” through both pessimistic and optimistic locking. Optimistic locking doesn’t end up locking anything, and it would have been better named optimistic locking-free or optimistic concurrency control because that’s what it does anyway. Lost updates So, what does it mean to “lose updates”? A real-life example would be when multiple background tasks update different attributes of some common Entity. In our example, we have a Product Entity with a quantity and… Read More
Open-minded architect
While chit-chatting with one of my colleagues, I was surprised to hear they use a PHP team for developing their front-end application, while the back-end services are implemented using Java. Since their project is doing great, this really got my thinking why I haven’t ever considered such an architecture. Most large Java web application I’ve been involved with have shone on the server-side part, while the client-side has been the Achilles heel. While you can find great Java web developers, not every Java developer has web-based skills. But PHP developers are great… Read More