Wrap IDs in objects

In Java, I like to wrap ID values in objects, rather than just passing them around the code as their native "int" or "long" or "String" values.

The reasons are twofold why using an object is better:

Things to consider when writing such an "ID object"

P.S. I recently created a nerdy privacy-respecting tool called When Will I Run Out Of Money? It's available for free if you want to check it out.

This article is © Adrian Smith.
It was originally published on 5 Dec 2013
More on: Java | Coding | Software Architecture