Inspired by this question in Stack Overflow, I decided to try my hand at implementing a Poset in Java. In order to understand how to do this, we need to define some concepts. Basic Poset terminology Poset definition A Poset is a set of elements with a binary relation defined between them (not necessarily between …
Category: Uncategorised
Scala’s uniform object model
Scala is functional and object-oriented. In a way, Scala is more object-oriented than Java as it has a uniform object model similar to Smalltalk’s. So what is this uniform object model? In a nutshell: every value is an object and every operation is a method call. That’s right, there are no primitive types, i.e. 1 …
Do you really know how to use the modulo operator?
It may come as a surprise but not all integer divisions are the same. Perhaps because we are used to operate mostly with positive numbers, we don’t pay too much attention to what happens when the modulo operator is used with negative integers. If you calculate the integer division of 7/3 in your favourite programming …
Read the full post →“Do you really know how to use the modulo operator?”
Folding things with Functional Programming
Introduction In this post we will discuss the concept of fold in functional programming: fold functions are used to reduce a data structure containing multiple values into a single one. Associated to the idea of fold are the concepts of recursion: via recursion, fold traverses the different elements of the data structure. summarisation: the data …
Read the full post →“Folding things with Functional Programming”
Microservice boundaries
Although working with microservices delivers many benefits, experience has shown that there are also some problems associated with their use. It is important to be aware of these issues so that their impact can be minimised. One of these problems is getting right the boundaries of microservices. This has proved to be one of the …
Focus on your data structures with Scala lenses
With new programming techniques come new problems and new patterns to solve them. In functional programming, immutability is a must. As a consequence, whenever it is needed to modify the content of a data structure, a new instance with updated values is created. Depending on how complex the data structure is, creating a copy may …
Read the full post →“Focus on your data structures with Scala lenses”
How to use your own domain to access an AWS-hosted website
If you have had a domain name parked for a while and want to put it to a better use, this post explains my experience in doing so. Since my idea was to create a very simple website with static content, I decided to use an AWS S3 bucket. AWS documentation is good so I …
Read the full post →“How to use your own domain to access an AWS-hosted website”
Linear programming with Python
A linear programming problem may be defined as the problem of maximizing or minimizing a linear function subject to linear constraints. The constraints may be equalities or inequalities. Here is a simple example: find numbers x1 and x2 that maximize the sum x1 + x2 subject to the constraints x1 ≥ 0, x2 ≥ 0, …
AWS Latency Index
In modern web applications, it is of paramount importance to deal with latency correctly. Within an application, latency reveals itself at many different levels and with very different values. Computer latency at a human level is a good reference to understand the different timescales. It is clear that the dominant term, by large, is the …
From Functional to Imperative programming
In 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 …
Read the full post →“From Functional to Imperative programming”