keechma 2016-05-16

@lewix has joined the channel

what's the difference between keechma and reframe (does it use reframe under the hood)

it doesn’t use re-frame

it uses reagent

it is another library that wraps reagent. Some of the main differences are that it provides a Controller and you have to declare your dependencies and the subscriptions that a component depends on

versus re-frame where you can willy-nilly emit events all over the place

What is the lib that it's similar to the redux workflow

it provides a little more structure

@lewix: I wrote about keechma design decisions here: http://retroaktive.me/blog/keechma-design-decisions/ . I’ve started with re-frame, but didn’t like the event ping pong + globals everywhere

it sounds like backbone

i think that might be re-frame, but I don’t know. I’ve never used redux

funny, I participated in the angularAttack hackathon this weekend, and we used Angular2. Was my first exposure to it. And it reminded me a lot of backone

@lewix: it’s not like backbone. Controllers operate on the route data, not on the view

controllers are there to recreate the app state based on the route data + to handle user actions.

@mihaelkonjevic: thank I'm reading your design decisions

@mihaelkonjevic: any idea what lib would be the closest to redux philosophy. In other words..global state.

so, I would say that keechma is sort of implementing the redux philosophy

the state is global to the app instance

it’s not a global variable

and it implements subscriptions (like in re - frame)

and with entitydb you get something that redux apps are missing - an entity store that takes care data synchronization across components

I’ve worked on a few redux apps, and one thing I’ve noticed is that people tend to organize their app state layout based on their ui layout (in a tree) which is a very costly mistake

another thing that I really like about keechma is that data always flows downwards which is explained with diagrams on this page http://keechma.com/01-introduction.html

"people tend to organize their app state layout based on their ui layout" - can you expand on that?

so I was working on an app that had user facing and company facing parts

and in their store

they were putting all user related data under the users namespace

they did the same with actions

so you had something that was laid out like this:

the problem happened when they wanted to show some user related data under the company part of the app

and there was no way to do it

because it was wired in a way where components could only call actions in their own namespace

so we had to copy / paste bunch of actions and some components to make it work

granted, this was a very pathological case

but, it was still pretty bad

entitydb allows you to treat your data store as a database with named items and collections

which allows you to have a single place for the data

that is accessible from anywhere

and if you load the same item from multiple places

it will update it in the entitydb, and changes will be automatically propagated through the app

so for instance, here I’m connecting to the websocket and consume the events, and based on these events I can update the entitydb, and changes will be automatically propagated to the ui https://github.com/keechma/keechma-place-my-order/blob/master/client/src/client/controllers/order_history.cljs#L48-L66

The problem you stated earlier might be a bad design decision, and it seems like it has little to do with redux. I'll add to that that the redux store is also accessible from anywhere. It's very easy to show the user related data under the company without having to copy/paste actions and components

it is, but you still have to manually take care of that

(in every app you build)

Thanks for the links; I'll check it out

@mihaelkonjevic: do i need to get familiar with re-frame to use keechma?

I'll give it a try

I don’t think so. I’ve tried to put together a good documentation, and there are a few examples to get you started. Also, if you have any questions I will be glad to answer them 🙂

no need to know re-frame

it actually hurt me to know re-fra,e

because I was still in the re-frame mindset

@roberto: so what do you prefer...

@mihaelkonjevic: is not allowed to answer since he's biased

i just migrated an app from re-frame to keechma

at a first glance re-frame seems complicated

it looked simple to me

and keechma looked a little complicated, but once I started working with keechma, my opinion changed

keechma seems simpler to me (at a first glance)

one of the things that annoyed me about re-frame was making xhr requests

you have to dispatch to a handler, that handler has to make an xhr request, and return an app-db. but since xhr is async

I have the feeling that I'm going to go back to the redux world

I would say re-frame is actually easier to get started with than keechma. I still haven't decided which I prefer, but a lot of that has to do with i haven't used keechma for any kind of app yet. It looks promising to me and I feel like truly reusable components will be achievable.

you have to also dispatch to another handler once the data has returned and modify the app-db

I'll give it keechma a try though

hey gadfly361 !

I didnt know you were hanging out here too

I like trying things that challenge me and make me feel uncomfortable. Once I start feeling comfortable with it I can see the pros and cons

Hey @lewix nice to see you again!

I have to admit that learning keechma took me longer than re-frame, but I think it was because I still had the re-frame mindset

roberto: xhr request with reframe?

@gadfly361: I think that re-frame avoids a lot of boilerplate that keechma requires, but I also think that globals are bad, so that’s a price I’m willing to pay. But, it’s still a problem. I plan to focus on the Keechma convenience layer (and docs, a lot of docs and tutorials) in the near future, to make it possible to avoid a lot of repetition.

does reframe use global variables?

the app state

is it global to the app instance?

it’s defined on the namespace level

so it’s global to everything

I like that idea, I think making keechma even more accessible is a good area of focus bc the ideas in it are really interesting. (For the record, I still love re-frame and really like mike, just want to see both succeed bc they will push each other forward!)

definitely, also if there was no re-frame, there would be no keechma 🙂

it's hard to choose

because it made it possible for me to really get into the whole clojurescript world

me too. I’d always choose re-frame if I had to choose bw re-frame, angular, ember and react/redux

btw, one of the things I’m really excited about is the forms lib I’ll be releasing soon. It’s decoupled from keechma, so it can be used with any reagent based app, but it solves one of my biggest pains - forms validation. The only things that are missing are docs and demos, but it has some really nice features, like validator composition, nested validators, validation of deeply nested objects etc… here are the validator tests https://github.com/keechma/forms/blob/master/test/forms/test/validator.cljs so let me know what you think about it

🎉 2

Validation has always been a pain for me, can't wait to try out