DEV Community

Contextualising identifiers in a system

Shabd Saran on August 02, 2023

Introduction At least two unique identifiers exist even in the most rudimentary authentication systems: user ID and session ID. It is ha...
Collapse
 
anubhavitis profile image
Anubhav Singhal

Is there a better way than prefix?
In vast system, prefix context might also become confusing jargon. How about the UUID encryption contains a 2nd layer info about the context which can be resolved by platforms to get context?

Collapse
 
saranshabd profile image
Shabd Saran

That's an interesting approach. Hadn't thought of it. Regardless, the suggested approach also takes in account non-programmers. It will be easier for them to recognise an identifier with a prefix in a third-party ecosystem, e.g. the Google Analytics dashboard.

Collapse
 
kailash_chandak profile image
kailash chandak

I believe its better to handle at different level rather the actual value itself.
How about having structured logs(for logging system) with key=value approach to handle this.

Collapse
 
saranshabd profile image
Shabd Saran

That's an approach generally taken by systems that want to retain the context in logs. However, it's difficult to predict the exact scope of an identifier. For example, what if the user ID ends up in the Google Analytics dashboard? We might not always have the freedom to tag context of an identifier especially when it propagates outside the system.

Thread Thread
 
anubhavitis profile image
Anubhav Singhal

agreed.