Java features explained with examples

Posts in category Uncategorised

Inversion of Control vs Dependency In...

Background Lately, I have been interviewing candidates for a Developer role and realised how much confusion there is, still, around the concepts of Inversion of Control and Dependency Injection. The majority of people use both terms interchangeably. Probably, the confusion derives from the heavy use of those concepts on Spring, where Inversion of Control is used to enable Dependency Injection. […]

Object-Relational Mapping pitfalls

Background Object-Relational Mapping (ORM) has become an indispensable tool to work with relational databases in Java applications. This topic, along with JPA and Hibernate, has been the subject of innumerable articles. Therefore, the present post will not enumerate again the pros and cons of using these tools but describe a real situation involving the misuse of ORM.   […]

How to keep your microservices straig...

Here is a post about… microservices and Docker, what else? With this post I want to illustrate the recent problems I have had at work to deal, on my local environment, with all the microservices that form part of our infrastructure. There is a lot of literature about microservices and the challenges of adapting Production environments to […]

Tuning an Akka application

This post presents an example of how to tune an Akka application. The first section presents the application (actually, a simple microservice) that will be used along this post to illustrate the tuning process. The second section describes the load tests and tools that will be used to measure the application performance. Next section presents different test scenarios […]

Unveiling blocking operations

Background Developing an application following the reactive principles can be quite challenging, specially when working with third party libraries, as these may not be fit for purpose, i.e. blocking operations. In such cases, the first challenge is to find the blocking operation and the second to confine it so that it does not affect the rest of the […]

Challenges of building a Dev environm...

Background One of the main difficulties when developing an application is “imagining the form” of the application on the Production environment. The components/services that developers use to build the application on their local environment may differ greatly of those used on the environments of the deployment pipeline. Admittedly, technologies like Vagrant and Docker aim to make […]

Functional programming

This post presents some features of functional programming with Scala. In essence, functional programming is about programming by making use of mathematical functions. All well-known features of functional programming are just a result of using mathematical functions, e.g.: referential transparency immutable state higher-order functions pattern matching I especially like ‘pattern matching’ as it allows for a […]

Dealing with memory leaks

Background This post describes my experience playing around with Scala and some of its concepts like tail recursion and futures. It also offers an opportunity to see how a memory leak can happen and how to analyse it. I created a simple web crawler that takes a seed link (e.g. http://www.bbc.co.uk) and then, recursively (using tail recursion), collects all […]

AWS Key Management Service

One of the main concerns when developing an application is where/how to store the application secrets such as database passwords, tokens, etc. This post explores the use of AWS Key Management Service to manage the secrets in a Spring Boot application. The steps followed to configure AWS KMS are described in the next sections.   […]

Running Docker on AWS

Recently, while developing a new microservice, I decided to create a “mockserver” to mock a third party system. In order to do that, I created a Docker container encapsulating the server and the stubs to be served in response to the application requests. After running the microservice locally making use of the mockserver, the time […]