top | item 40004748

(no title)

shinzui | 1 year ago

The author seems to be unaware of TypeID. You can use TypeID and ignore this article.

https://github.com/jetify-com/typeid

discuss

order

graypegg|1 year ago

Is this particularly widely used? I don't think I'm aware of TypeID either. I don't see why the author's pretty light solution is inferior to this library.

shinzui|1 year ago

Because TypeIDs are compatible with UUIDv7 and are supported by libraries in many languages.

paulddraper|1 year ago

Or rather, the article is the explanation of typeid?

layer8|1 year ago

Underscore has usability drawbacks.

feoren|1 year ago

So your IDs are now tightly bound to whatever "types" you've currently decided you have, forcing a narrow view of what an entity is and making the entire system extremely brittle to change? What is a "type" even supposed to be? This is forcing a doubling-down on an already problematic design principle: that every entity is exactly one type of thing and these types of things are completely different than those types of things and obviously you can just make the perfect set of types that will never change if you think think really hard and everyone will agree on what each type means and they'll never change and that will never be a problem.

Jesus, what a nightmare.

michaelsalim|1 year ago

A quick glance of the repo shows that the "type" is just a prefix. You can do whatever you want with it. Basically the same thing as what the article suggests, no?

likium|1 year ago

You face the same issues with table names though. So do you not name your tables?

The solution to your entity problem should be the same. You do the reasonable, practical thing, and rename/refactor if they drift away from the original mental concept.