Testing the limits of your application

When we first learn to program, we are taught to be mindful of the computer’s resources; they must be used sparingly and released as soon as possible. So you know the drill: close files, release database connections, close sockets, free memory, etc. But have you ever wondered who sets the limits of what can be …

This would not happen with Java

One of the main differences between C and Java is the capability of C to perform low-level memory operations. This allows for great power and flexibility but is also a constant source of bugs. In that sense, Java is considered a safer programming language. This post presents some examples in C that would not happen …

Java Date and Time API explained by example

The handling of dates and times is a sure source of pain and confusion. While time is a familiar concept that everybody knows intuitively, it is difficult to formalise when developing an application. This post aims to shed some light by presenting different use cases implemented with Java Date and Time API. Flight tickets The …

How to construct objects in Scala

Scala’s object-oriented programming style comes with some syntactic sugar and a few tricks. In order to get a better understanding of how Scala works, we will examine a few Scala examples and the corresponding byte code (in reality, the Java code resulting from decompiling the class files). Examples Empty class Simplest possible example, an empty …

How to implement a Poset in Java

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 …