I left company for which I’ve been working for last 4 years and now it is time to summarize my experiences. It is not story of shady business nor confession of my sins (not all of it anyway), but rather my thoughts and experiences on working for long time in the same company from which most of the time remotely.
Some time ago I’ve been struggling with mapping hierarchical data structure in angular. Labels hierarchy was complex (like 4 levels deep with multiple parents, multiple children, basically graph like structure with some logic behind it). In the end it was/is still working but that’s the best I can say about it.
We all love to write new stuff and learn about things. But when we’ve got to do something in one of the older applications we’d rather avoid it and lag as long as possible hopping that someone else will handle it. You shouldn’t be afraid of legacy code (as long it is not ball of mud). You should take the opportunity to look into the past, and learn from it as much as possible.
Some time ago I noticed new library in our code base - Random Beans which as the name suggest is tool developed to easily create random data and random objects for testing purposes. Unfortunately we used it in the wrong way. Here’s how we backed up from the the random test data to regain control over testing.
Some time ago I’ve been trying to dynamically create spring beans. After fast stackoverflow check I decided to drop it and go with something else. Lately I’ve been trying to implement more complicated bean registration mechanism in which skipping dynamic bean creation wasn’t an option. Here’s how you can create spring beans “from code”.
Working with a lot of data using plain JPA or hibernate or spring-data is possible, it does work and usually it doesn’t require a lot of extra codding. Starting small is the fastest way of getting things done but you must be aware of few things that might shoot you in the foot.
Optimistic locking is concurrency control method that allows to execute multiple transactions simultaneously as long as they don’t interfere which each other. That’s definition from wikipedia. You probably already know that hibernate supports optimistic locking and all you have to do in order to implement optimistic locking in you app is to add @Version on number or timestamp field and you are good to go. Right?
Immutability and functional programming are hot right now. But how to achieve immutability with objects deserialized from json? Luckily there is pretty old feature introduced in jackson 2.7.0 which uses constructor based object creation and uses @ConstructorProperties (introduced in java7).
Every codebase depends on multiple external libraries. It is good idea to stay up to date with external dependencies. It is important to update all security related stuff and it might be helpful or fun to use latest features. I’m going to share my way of staying up to date with external dependencies in maven, gradle and npm.