There doesn’t seem to be much available online regarding datomic attribute naming conventions. I started thinking about this because I realized I was using
. inconsistently in my attribute names. I’m hoping to find out what people think is the best convention.
I find that in real-world databases you end up with more nested names than those found in the example schemas. For example, in an application for making surveys, we have this attribute:
:question.contact-info.channel/validation. “Contact Info” is a type of question that allows specifying different contact channels (like email, phone, etc) and input validation for each channel. So this naming convention is basically
class.sub-class.inner-class/attribute. I’m using “subclass” and “inner class” to mean roughly what they do in java. This convention is imperfect because the separator for subclasses is the same as the one for inner classes. The ambiguity can be removed by introducing a different separator character:
To more thoroughly specify this convention:
-is a word separator, like in clojure var names.
.indicates nesting/“inner classes”.
I haven’t actually started using this convention yet, but it seems like an improvement over the ad hoc approach I’ve been using. Thoughts?