When to Use Uuid, Uid and Id?fleeting
- id means without collision with another id in the scope of one entity,
- uid means without collision with another id in the scope of one system,
- UUID means implemented according to the RFC 4122 that promises minimum risk of collision even across systems,
Here, I mean entity as what the user sees. The fact that under the hood the entity is composed of several sub-entities does not matter, as long as the user feels like per communicates with one single entity.
By contrast, if the user communicates with several separate entities distributed across several domains :
- each entity may refer to id, conveying the information that it might have collision with other entities,
- each entity may refer to uid, conveying the information there will be no collision with others entities of the system,
Hence, using the notion of uid needs to first be clear about the definition of the system, as in the set of entities that the user may have to communicate with.