Fork me on GitHub
#om
<
2017-09-20
>
wilkerlucio20:09:22

Hello people, I would like to ask your opinion on something. Over the internet when we see Om.next code examples, most of then (all that I saw) demonstrate the creation of idents as [:group/by-id], [:user/by-email], always with the -by pattern. Recently I was trying something different, and did remove the by-, and some notable differences are: in some cases I can just use it directly as a Datomic lookup ref; it makes easier to translate in query fields. In summary, by removing the by- I feel like I had one less translation step to do. So I wonder how are you defining your component idents? Are you using the by- pattern? Did anybody tried to use a generic :db/id for everything?

levitanong22:09:34

@wilkerlucio I use the by- pattern. I’ve thought a bit about switching to match datomic’s lookup refs, but I’m kind of uncomfortable about having a property that looks exactly like the dictionary of its own parent. I’m not keen on :db/id because you lose information on what the thing is. For example, for a client project, because of oracle, we have to rely on combination fields to convey identity, so I have to do something like [foo/by-path [0 2 :bar 4]] if there are several components that make use of “paths”, then it’s useful to know what object it is.

wilkerlucio23:09:38

@levitanong interesting, makes total sense when using tables where the identities are clear