Java features explained with examples

Posts in category Uncategorised

From Functional to Imperative program...

In http://blog.bytecode.tech/the-power-of-generic-algorithms/, we mentioned the need of taking into consideration the physical limitations of time and space when writing an algorithm. In this post, we will show how the anatomy of an algorithm varies as successive optimisations are added. This change is reflected, especially, in the shift from a functional to an imperative style. As we […]

Statistics for Machine Learning

One of the first things that one encounters when studying Machine Learning is a barrage of terms like: inferential statistics, statistical test, statistical hypothesis, null hypothesis, alternative hypothesis, p-value, probability distribution… and the list goes on and on. This may prove discouraging for those who are not familiar with Statistics. The present post aims to […]

The power of generic algorithms

In computer science, there is this tension between creating generic algorithms applicable to different situations and optimising an algorithm to solve a specific problem. Generic algorithms make it possible to find similarities between problems that, at first glance, may seem completely unrelated. This is especially interesting when those problems belong to different domains. When this […]

Traps for numbers

This post is a playful combination of maths and computing to design “traps for numbers”. Here is the accompanying code to this post along with its tests. Collatz sequence Many classical problems in maths can be given a new twist with the help of computers, resulting in surprising results. One of these problems is the […]

Using Composite Java pattern to switc...

Design patterns is probably one of the most popular topics in the Java blogosphere. Yet many times the examples used to illustrate the different design patterns are not very engaging. To remedy that, this post explains the Composite pattern in a fun way. Since there are already many descriptions of this pattern out there, we […]

Java phasers made simple

I recently came across Java phasers while reviewing different constructs for inter-thread communication. Phasers are associated to the concepts of fuzzy barriers and point to point synchronisation which are all well explained on this parallel programming course. As to this post, I will borrow the example of the one-dimensional stencil to explain very intuitively the motivation behind the concept of […]

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 […]