keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
lewix 2016-05-16T21:12:17.000121Z

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

roberto 2016-05-16T21:18:39.000122Z

it doesn’t use re-frame

roberto 2016-05-16T21:18:46.000123Z

it uses reagent

roberto 2016-05-16T21:19:35.000124Z

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

roberto 2016-05-16T21:19:59.000125Z

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

lewix 2016-05-16T21:20:10.000126Z

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

roberto 2016-05-16T21:20:11.000127Z

it provides a little more structure

mihaelkonjevic 2016-05-16T21:20:21.000128Z

@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

lewix 2016-05-16T21:20:27.000129Z

it sounds like backbone

roberto 2016-05-16T21:20:30.000130Z

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

roberto 2016-05-16T21:21:25.000131Z

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

mihaelkonjevic 2016-05-16T21:21:35.000132Z

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

mihaelkonjevic 2016-05-16T21:22:16.000134Z

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

lewix 2016-05-16T21:22:27.000135Z

@mihaelkonjevic: thank I'm reading your design decisions

lewix 2016-05-16T21:27:30.000136Z

I see

lewix 2016-05-16T21:27:59.000137Z

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

mihaelkonjevic 2016-05-16T21:29:27.000139Z

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

mihaelkonjevic 2016-05-16T21:29:34.000140Z

the state is global to the app instance

mihaelkonjevic 2016-05-16T21:29:43.000141Z

it’s not a global variable

mihaelkonjevic 2016-05-16T21:29:53.000142Z

and it implements subscriptions (like in re - frame)

mihaelkonjevic 2016-05-16T21:30:35.000143Z

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

mihaelkonjevic 2016-05-16T21:31:35.000144Z

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

mihaelkonjevic 2016-05-16T21:34:55.000145Z

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

lewix 2016-05-16T21:35:48.000146Z

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

mihaelkonjevic 2016-05-16T21:35:55.000147Z

yes

mihaelkonjevic 2016-05-16T21:36:08.000148Z

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

mihaelkonjevic 2016-05-16T21:36:20.000149Z

and in their store

mihaelkonjevic 2016-05-16T21:36:36.000150Z

they were putting all user related data under the users namespace

mihaelkonjevic 2016-05-16T21:36:46.000151Z

they did the same with actions

mihaelkonjevic 2016-05-16T21:36:59.000152Z

so you had something that was laid out like this:

mihaelkonjevic 2016-05-16T21:38:18.000154Z

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

mihaelkonjevic 2016-05-16T21:38:23.000155Z

and there was no way to do it

mihaelkonjevic 2016-05-16T21:38:41.000156Z

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

mihaelkonjevic 2016-05-16T21:39:04.000157Z

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

mihaelkonjevic 2016-05-16T21:39:17.000158Z

granted, this was a very pathological case

mihaelkonjevic 2016-05-16T21:39:30.000159Z

but, it was still pretty bad

mihaelkonjevic 2016-05-16T21:39:53.000160Z

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

mihaelkonjevic 2016-05-16T21:40:29.000161Z

which allows you to have a single place for the data

mihaelkonjevic 2016-05-16T21:40:35.000162Z

that is accessible from anywhere

mihaelkonjevic 2016-05-16T21:40:49.000163Z

and if you load the same item from multiple places

mihaelkonjevic 2016-05-16T21:41:09.000164Z

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

mihaelkonjevic 2016-05-16T21:45:19.000165Z

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

lewix 2016-05-16T21:45:34.000167Z

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

mihaelkonjevic 2016-05-16T21:45:53.000168Z

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

mihaelkonjevic 2016-05-16T21:46:18.000169Z

(in every app you build)

lewix 2016-05-16T21:46:55.000170Z

Thanks for the links; I'll check it out

lewix 2016-05-16T21:48:21.000171Z

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

lewix 2016-05-16T21:48:42.000172Z

I'll give it a try

mihaelkonjevic 2016-05-16T21:49:20.000173Z

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 🙂

roberto 2016-05-16T21:59:13.000174Z

no need to know re-frame

roberto 2016-05-16T21:59:35.000175Z

it actually hurt me to know re-fra,e

roberto 2016-05-16T22:00:10.000176Z

because I was still in the re-frame mindset

lewix 2016-05-16T22:01:19.000177Z

@roberto: so what do you prefer...

lewix 2016-05-16T22:01:33.000178Z

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

roberto 2016-05-16T22:01:33.000179Z

keechma

lewix 2016-05-16T22:01:43.000180Z

🙂

roberto 2016-05-16T22:01:44.000181Z

i just migrated an app from re-frame to keechma

lewix 2016-05-16T22:02:12.000182Z

at a first glance re-frame seems complicated

roberto 2016-05-16T22:02:26.000183Z

it looked simple to me

roberto 2016-05-16T22:02:39.000184Z

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

lewix 2016-05-16T22:02:55.000185Z

keechma seems simpler to me (at a first glance)

roberto 2016-05-16T22:03:08.000186Z

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

roberto 2016-05-16T22:03:39.000187Z

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

lewix 2016-05-16T22:03:48.000188Z

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

gadfly361 2016-05-16T22:03:58.000189Z

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.

roberto 2016-05-16T22:03:59.000190Z

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

lewix 2016-05-16T22:04:09.000191Z

I'll give it keechma a try though

lewix 2016-05-16T22:04:37.000192Z

hey gadfly361 !

lewix 2016-05-16T22:04:48.000193Z

I didnt know you were hanging out here too

roberto 2016-05-16T22:04:55.000194Z

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

gadfly361 2016-05-16T22:05:26.000195Z

Hey @lewix nice to see you again!

roberto 2016-05-16T22:05:37.000196Z

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

lewix 2016-05-16T22:06:14.000197Z

roberto: xhr request with reframe?

roberto 2016-05-16T22:06:46.000198Z

yep

mihaelkonjevic 2016-05-16T22:07:30.000199Z

@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.

lewix 2016-05-16T22:09:39.000200Z

does reframe use global variables?

roberto 2016-05-16T22:10:02.000201Z

the app state

lewix 2016-05-16T22:10:25.000202Z

is it global to the app instance?

mihaelkonjevic 2016-05-16T22:10:34.000203Z

it’s defined on the namespace level

mihaelkonjevic 2016-05-16T22:10:49.000204Z

so it’s global to everything

gadfly361 2016-05-16T22:10:49.000205Z

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!)

mihaelkonjevic 2016-05-16T22:11:30.000206Z

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

lewix 2016-05-16T22:11:51.000207Z

it's hard to choose

mihaelkonjevic 2016-05-16T22:11:51.000208Z

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

roberto 2016-05-16T22:12:06.000209Z

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

mihaelkonjevic 2016-05-16T22:18:40.000210Z

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
gadfly361 2016-05-16T22:19:56.000212Z

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