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"

This article is © Adrian Smith.
It was originally published on 5 Dec 2013

Follow me: Facebook | Twitter | LinkedIn | Email

More on: Java | Coding | Software Architecture