Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So, in principle I like everything with David's new approach... the main question I have is "How well do 'recursive queries' work when the data relationships between my components is really complex?" I think I will only be able to answer that question by trying this approach myself and seeing how it performs for my needs.

(Another question is: "How am I going to use this when my server's database is a blockchain and not a conventional database [1] like datomic?" but I know that's a niche question I'll have to figure out for myself.)

[1] Just kidding (mostly)



Thats indeed something that doesn't seem to be discussed much, even if you look at graphql's presentation - https://www.youtube.com/watch?v=WQLzZf34FJ8 there seems to be a lot of redundancy when "my friends including their events" is fetched.

I imagine that a scheme based on an UUID and deduplication would work - when constructing the response an object repository is kept and if an object with the same uuid appears twice its replaced with a reference to them.

Going against the "don't extend JSON" best practice, that would be:

  {
    "friends": [{ 
      "name": "Name", 
      "events": [#uuid1, #uuid2]
    }, {
      "name": "Another name",
      "events": [#uuid1, #uuid2]
    }],
  }
  #{
    "uuid1": {"name": "MyEvent", "description": "..."},
    "uuid2": {"name": "OtherEvent", "description": "..."},
  }
And it can support cyclic references too, as a bonus. Ignoring best practices is so... liberating.

Ultimately this is just compression though. Its possible that gzip will be quite sufficient for most cases.


Transit [1] can do this for you.

[1] https://github.com/cognitect/transit-format




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: