All experiences i've ever have with 'Encoded IDs' have been really really bad. Often an ID just needs to serve 1 purpose - to be a unique identifier for an entity, typically a row in a database, from which to SELECT or JOIN on.
Encoding extra information into a unique ID rarely does you any favours, and if anything just imposes a bunch of restraints on what counts as an 'acceptable' ID. It is the database equivalent of condensing all your columns into a single text string, and in the process removing all constraints, indexing and the ability to modify data. It leads to all sorts of weird behaviours and headaches down the road for both the implementers and the users.
There are circumstances where an ID could have some structure; particularly useful is when the first few letters tell you which database the ID comes from, and the last few characters represent a version number - but beyond that you should really just use a plain, incrementing numbers of varying length to give you the uniqueness, but also as much flexibility down the road as possible. Consider the following:
- Will the format and all valid substrings of an ID be intuitively known to new users, or could it lead to confusion when, for example, Mus stands for muscle and not mouse?
- Once a Unique ID is generated, will any of that encoded data be liable to change? For example, if you encoded lncRNA family into the ID, but new data shows that a certain lncRNA actually belongs to family B not family A, will you change the ID, breaking all existing references to the lncRNA, or will you maintain both the old (incorrect) ID and the new one?
- Is the database implementation that gets data for a given ID so slow or complicated that it saves much time/complexity storing data in the ID itself?
- Will you store all the data captured in the ID in separate columns anyway?
I obviously dont know your circumstances or requirements, so maybe none of this is applicable, but personally I feel the less parsing you make your users do and the more your database does, the happier everyone will be :)
5.1 years ago by
John ♦ 12k