Fork me on GitHub
#re-frame
<
2016-05-02
>
fasiha01:05:01

@mikethompson: posh looks like… an alternative to re-frame, to me?

mikethompson01:05:39

Sure. But if might be perfect for some.

adamkowalski01:05:36

@mikethompson: have you thought about adding datascript support to reframe?

adamkowalski01:05:50

on the github page you say that one of your goals is declarative queries

mikethompson01:05:58

I believe that's what Posh is about simple_smile

mikethompson01:05:18

Have a look at this recent talk to see the big picture: https://www.youtube.com/watch?v=aI0zVzzoK_E

adamkowalski01:05:53

yeah i saw that it looks pretty nice, https://www.youtube.com/watch?v=rOKOCAkHNYw also looks pretty interesting

adamkowalski01:05:26

I really like the reframe subscription + handler system though, it really fits my train of thought

fasiha01:05:00

Trying to see how pure posh handles subs/dispatch

fasiha01:05:22

It's readme lacks a certain thing… length, mainly—which I've come to expect thanks to re-frame.

mikethompson01:05:30

Sure. This is more a heads up about what Posh offers. I watched the "Datalog all the way down" talk and really liked what they are doing. So I wanted to be sure they got enough attention -- I think their approach has promise and merit. Things like OM Next get hyped into the stratosphere which is a shame when other technology has as much, if not more merit.

adamkowalski01:05:29

to be fair, I think some of the things they are doing with OM next are incredible. I think that each library has a lot of pros and cons, and can all inspire each other to become better,

adamkowalski01:05:42

the ability to get all of the queries of all the child components and send back one request which encapsulates all the data your application needs is really useful and in general systems like relay/graphql/om next/apollo seem to be really promising for large scale apps

mikethompson01:05:05

For some apps, that might certainly be useful. But not my apps.

fasiha01:05:12

@adamkowalski: so is there nothing in posh/datascript that aggregates all children's queries into one query to send "the server"?

mikethompson01:05:20

And my apps tend to be pretty big

adamkowalski01:05:39

@fashia: ill be honest, I haven’t used posh or datascript long enough to make a claim one way or another.

mikethompson01:05:46

Anyway, I just wanted a promising approach to be given its fair acknowledgement.

fasiha01:05:22

@mikethompson: understood, I won't see it as a mother bird pushing fledglings out of the nest 😛

adamkowalski01:05:49

Also, I think that whether or not they currently support that, it seems like something really interesting for them to add in the future

adamkowalski01:05:12

I think in the video they already said that if two components rely on the same query it doesn’t get run twice, so thats great

adamkowalski01:05:03

and the fact that your backend/frontend have the same semantics when it comes to storing state means that syncing the two could become a lot simpler

fasiha01:05:25

I'm tremendously enjoying re-frame on front-end and Ring/Compojure on backend, but now I need some kind of persistence, syncing clients, etc.—db in short, and am scratching my head where to go, and they tell me Datomic has a low impedance mismatch for Clojure/Script apps, so this posh/datascript mention feels timely for me…

fasiha01:05:25

But thanks to this discussion, I feel like I can introduce one new thing at a time—if that's Datomic, don't also introduce posh.

adamkowalski01:05:25

another thing to look at is rum

escherize02:05:21

I've had awesome results with Postgres and RethinkDB, @fasiha. Happy to share experiences on either datastore

fasiha02:05:33

@escherize: at the same time?

escherize02:05:54

No but the approach has been remarkably similar

fasiha02:05:57

I meant, combining the two, or both Postgres & Rethink?

escherize03:05:18

I used to use postgres for everything now I am using rethink on my current project

fasiha03:05:25

Do you treat re-frame's app-db as a sub-view (or whatever) of the db?

escherize03:05:04

I would say yes, but that is maintained through REST for the most part

escherize03:05:10

Basically we have a bunch of maps to persist. Like a user-account or a payment-notification etc. so those are tables in postgres (or rethink) which would have schemas for their important fields.

escherize03:05:27

But now I suppose you're asking about syncing app-db with something

escherize03:05:36

(now that I've re-read it !)

escherize03:05:31

If anyone's interested in rethinkdb, I've put some slides I put together for a meetup up: http://escherize.com/rethinkdb_talk/

adamkowalski03:05:33

thanks for putting that up. can you say a little more about why you chose rethinkdb over something like datomic?

escherize03:05:01

Sure.. Rethinkdb is opensource for one

escherize03:05:55

I'm not too familiar with datomic's admin interface but I can say that rethinkdb's is really good - easy to understand, etc.

escherize03:05:22

also rethinkdb's query language is based on s-expressions, which makes it a nice fit

escherize03:05:47

and the idea of setting up subscriptions on a database is really amazing as well

adamkowalski03:05:06

hmm maybe I should try it out

adamkowalski03:05:30

so would you recommend using one.love with rethink?

escherize04:05:52

I like one.love, but it wasn't out when I started my latest project so I've been using clj-rethinkdb which is also good. I think one.love has a better interface, but I'm not sure if it can do everything in the rethinkdb spec.

juliobarros12:05:11

@escherize: oil thanks. Hadn't seen one.love before. Btw how do you deal with keyword values (if at all)? I hate losing them in the Jason conversion.

escherize13:05:59

Hey @juliobarros, where do the keyword values get you down?

escherize13:05:10

like, on a POST from the client to the server?

fasiha13:05:58

It might have been because it was my first project using RethinkDB (or really any schema-less db—it was a Node project), but I had queries that were really intricate, and not very readable if all you knew was JS. I was uncomfortable having to require contributors to have to learn the Rethink query API. But that seems inevitable—even Datomic has a query API.

escherize13:05:11

That's interesting. I agree that schema-less can be a pain. Here's the query I use to look up customers:

(defn find-customers [k v]
  (-> (r/table "customers")
      (r/filter (r/fn [row]
                  (r/eq v (r/get-field row (name k)))))
      (r/run conn)))

fasiha13:05:42

@escherize: why did you move to Rethink from Postgres?

escherize13:05:13

live updates, easier admin, less friction when changing schemas

escherize13:05:59

I won't lie - I did get burned by having broken data in the dev db before. But here's how I enforce schemas:

(s/defn insert! [new-customer :- schema/NewCustomer]
  (let [customer (-> new-customer
                     (update-in [:password] hs/encrypt)
                     (assoc :timestamp (t/now))
                     (assoc :free-messages 30)
                     (assoc :id (id/customer-id))
                     (assoc :token (id/token-id)))
        cust-val-fn (partial s/validate schema/Customer)]
    (-> (r/table "customers")
        (r/insert [(cust-val-fn customer)])
        (r/run conn))
    customer))

escherize13:05:35

basically when updating the schema, it can be nessicary to run a migration query

fasiha13:05:03

Gotcha, thanks that's helpful.

escherize13:05:49

Thanks man, but we should probably move off the re-frame channel 🍻