Hi everyone,

In a recent talk, David Nolen talks about a great idea for Om Next, where 
components declaratively describe what data they’re interested in. [omnext] I’d 
like to explore the optional server-side router part. The idea is that you 
write your code on the front-end as if you have *all* the data; then, in the 
background, you download just enough data to do it. This idea has also been 
explored by Facebook with Relay, and Netflix with Falcor.

Since David suggested using Datomic pull syntax to describe what data you’re 
interested in, Datascript was my first port of call. The author of Datascript 
has also written a superb article on exactly this topic. [webtmrw]

Falcor has it easier, though; because it solves a very specific problem. It 
does asynchronous access for strictly hierarchical model objects whose schema 
is known completely ahead of time, and  without any querying capabilities like 
Datascript’s.

The challenge is that Datascript is really just a bunch of tuples in a few 
sorted sets. [dsint] We’re trying to teach it about data that *doesn’t* live 
there.  While Datascript makes it easy to write additional backends (IDB, 
ISearch, IIndexAccess), those APIs are synchronous, so I can’t do much in the 
browser.

The obvious piece of data to ferry around is the datom; the hard part is:

1. knowing if there’s datoms you don’t know about, but live on the server,
2. as the server, knowing which datoms are relevant.

One approach might be to just run queries on the server as well as on the 
client. Another is to add “hints” that there’s some data here, but you just 
don’t know what it is. (The problem is that the latter breaks pretty easily; 
it’s not like you can do range queries on `:go-ask-the-server`…)

Finally, there’s backing this data with, say, a legacy REST API or something. 
That’s fine as long as you do it on the server, because the blocking 
restriction goes away.

Due to my relative inexperience with Datascript/Datomic, I wanted to reach out 
to the mailing list before continuing. Is anyone else working on something 
similar? Good results, dead ends?

[omnext]: https://www.youtube.com/watch?v=ByNs9TG30E8
[webtmrw]: http://tonsky.me/blog/the-web-after-tomorrow/
[dsint]: http://tonsky.me/blog/datascript-internals/


hth
lvh

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to