RSS

Meaningful Identifiers

Meaningful Identifiers

2021 01 02 head

Identifiers are a key concept to successfully model complex business domains. They permeate how our modern civilisation functions. Could you imagine a country without car registration number, internet addresses, postal addresses or social security numbers?

Identifiers are identifiers.

Identifiers cannot be changed at any time. Updating identifiers means introducing mapping relations between the old and the new values.

In computer science, identifiers IDs are lexical tokens that name entities.
Identifiers are used extensively in virtually all information processing systems.
Identifying entities makes it possible to refer to them, which is essential for any kind of symbolic processing.

External Well-Defined Identifiers

The best identifiers are externally well-defined identifiers. A unique and well-defined authority is responsible to define and publish them. Ideally the authority should only create new identifiers and never delete existing ones. The published information is available to all interested parties.

Examples are

  • Currency names as defined in ISO standard 4217,
  • Country abbreviations as define in ISO standard 3166,
  • Social security numbers are well documented in the country they are used,
  • Car numbers are well-known and documented.

Try to use global externally defined identifiers as much as possible. Always document the authority in charge to create these identifiers.

Examples you are using are

  • IBAN account numbers are defined worldwide through ISO 13616,
  • Bank connections are defined as Business Identifier Codes through BIC ISO 9362. The registration authority is SWIFT,
  • Car numbers and country acronyms are defined worldwide,
  • Passport numbers are defined worldwide. Each country has its own structure and conventions,
  • Social security numbers are a counter-example. There are currently only defined locally.

External Managed Identifiers

You shall document the source of truth for all externally defined and managed identifiers.

The source of truth shall work as a benevolent responsible. It should support all interested parties and guaranty their identifiers can be trusted.

Internal Managed Identifiers

One possible approach is to define a naming convention such as

Year - Acronym - Counter

An example of such an identifier would be

2021-CNT-0001 (Contract number 1 in year 2021)
2020-EVT-0101 (Event number 101 in year 2020)

Variations are

  • A full date as prefix, our system uses this convention to name invoices,
  • A more readable acronym, our ERP system uses the word invoice to name invoices.

Beware if you export internal managed identifiers you become a source of truth. You are responsible to document these identifiers, and the process to create new ones. You shall also guaranty that existing identifiers are never recycled. If your identifiers are strings, you shall clearly define the supported languages, and character sets.

Lessons Learnt

Always try to find an external well-defined identifier for your entities. Beware of legal aspects when you are using government defined identifiers such as social security numbers, passport numbers or car numbers.

Avoid by all means to use an internal privately defined identifier as a public one. You will bear the burden to document, manage and evolve the scheme as soon as you do this.

Related concepts are discussed in our blog series