Writing micro benchmarks in Java

Recently I have encountered a few articles on the web about performance in Java. The authors were comparing the execution time of different code snippets implementing the same functionality and tried to make conclusions about which one is more efficient. I have to say that I find the topic really interesting. I have seen a [...]

What is serialVersionUID?

Most people learn about serialVersionUID after they write their first serializable object (I know I did). You add ‘implements Serializable’ and in the next moment your IDE starts complaining… so what’s up?
Lets look at a simple example to see what meaning that variable has. In the example we will use the class SerializeMe shown below:

class [...]

How to write a Singleton (3/5)

In two previous posts I have tried to convince you not to implement the Singleton at all and to give up implementing it with lazy initialisation. Today I show how to write a singleton that uses lazy initialization. The presented code is one of 3 possible versions – the most readable one. Others will be [...]