OceanOPS / oceanops-json-standard

OceanJSON Standard Format definition
2 stars 0 forks source link

Question on Naming conventions #3

Open thogar-computer opened 1 day ago

thogar-computer commented 1 day ago

Morning, this looks really interesting, In the section below

In most cases, the name of the entity is included at the beginning of the property key, but not any parent entities.

For instance here, we name the property key 'deployment_country' - not 'country' or 'platform_deployment_country'

And we name the property key 'country_name' - not 'name' or 'platform_deployment_country_name'

{
"platform_deployment": {
  "deployment_method": {},
   "deployment_country": {
      "country_code3": "DEU",
       "country_code2": "DE",
       "country_name": "Germany",
       "country_id": 164
   }
}

I have a question as to why you took the choice of adding a pre-fix to the inner element?

from a coding aspect, it makes referencing an ingested object lengthy, and if someone wants to model the object there is less reuse available as country_name and country_id are now different from program_id and program_name.

again taking country_name as an example of the inner key, if we look at https://github.com/OceanOPS/oceanops-json-standard/blob/67de9b00bece383e25778c1cbeeb0a28f28c85ed/examples/ptf-output-example.json#L11C5-L11C17 we can see that the same inner key is repeated 7 times and have at least 4 values.

ultimately, I would be interested to know why the objects cannot be prefix-free

{
"platform_deployment": {
   "method": {},
    "country": {
       "code3": "DEU",
        "code2": "DE",
        "name": "Germany",
       "id": 164
    }
}
tomlatter commented 1 day ago

Hi Tom, thanks it's a good question! I think that my reasoning was that for some entities a prefix can avoid ambiguity and make it readable at a glance. And I wanted to apply the same naming logic throughout the whole structure. But you are right that for simple nested entites like country, prefix-free would be more intuitive. So I think I might only apply the prefix when there is a potential ambiguity (I can't remember which cases but there were only a few). It would make the whole object much lighter.

thogar-computer commented 3 hours ago

Super happy to act as a second pair of eyes or review any MR if you'd like :D