Fork me on GitHub
#keechma
<
2016-05-16
>
lewix21:05:17

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

roberto21:05:39

it doesn’t use re-frame

roberto21:05:46

it uses reagent

roberto21:05:35

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

roberto21:05:59

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

lewix21:05:10

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

roberto21:05:11

it provides a little more structure

mihaelkonjevic21:05:21

@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

lewix21:05:27

it sounds like backbone

roberto21:05:30

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

roberto21:05:25

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

mihaelkonjevic21:05:35

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

mihaelkonjevic21:05:16

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

lewix21:05:27

@mihaelkonjevic: thank I'm reading your design decisions

lewix21:05:59

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

mihaelkonjevic21:05:27

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

mihaelkonjevic21:05:34

the state is global to the app instance

mihaelkonjevic21:05:43

it’s not a global variable

mihaelkonjevic21:05:53

and it implements subscriptions (like in re - frame)

mihaelkonjevic21:05:35

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

mihaelkonjevic21:05:35

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

mihaelkonjevic21:05:55

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

lewix21:05:48

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

mihaelkonjevic21:05:08

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

mihaelkonjevic21:05:20

and in their store

mihaelkonjevic21:05:36

they were putting all user related data under the users namespace

mihaelkonjevic21:05:46

they did the same with actions

mihaelkonjevic21:05:59

so you had something that was laid out like this:

mihaelkonjevic21:05:18

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

mihaelkonjevic21:05:23

and there was no way to do it

mihaelkonjevic21:05:41

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

mihaelkonjevic21:05:04

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

mihaelkonjevic21:05:17

granted, this was a very pathological case

mihaelkonjevic21:05:30

but, it was still pretty bad

mihaelkonjevic21:05:53

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

mihaelkonjevic21:05:29

which allows you to have a single place for the data

mihaelkonjevic21:05:35

that is accessible from anywhere

mihaelkonjevic21:05:49

and if you load the same item from multiple places

mihaelkonjevic21:05:09

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

mihaelkonjevic21:05:19

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

lewix21:05:34

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

mihaelkonjevic21:05:53

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

mihaelkonjevic21:05:18

(in every app you build)

lewix21:05:55

Thanks for the links; I'll check it out

lewix21:05:21

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

lewix21:05:42

I'll give it a try

mihaelkonjevic21:05:20

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 🙂

roberto21:05:13

no need to know re-frame

roberto21:05:35

it actually hurt me to know re-fra,e

roberto22:05:10

because I was still in the re-frame mindset

lewix22:05:19

@roberto: so what do you prefer...

lewix22:05:33

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

roberto22:05:44

i just migrated an app from re-frame to keechma

lewix22:05:12

at a first glance re-frame seems complicated

roberto22:05:26

it looked simple to me

roberto22:05:39

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

lewix22:05:55

keechma seems simpler to me (at a first glance)

roberto22:05:08

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

roberto22:05:39

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

lewix22:05:48

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

gadfly36122:05:58

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.

roberto22:05:59

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

lewix22:05:09

I'll give it keechma a try though

lewix22:05:37

hey gadfly361 !

lewix22:05:48

I didnt know you were hanging out here too

roberto22:05:55

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

gadfly36122:05:26

Hey @lewix nice to see you again!

roberto22:05:37

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

lewix22:05:14

roberto: xhr request with reframe?

mihaelkonjevic22:05:30

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

lewix22:05:39

does reframe use global variables?

roberto22:05:02

the app state

lewix22:05:25

is it global to the app instance?

mihaelkonjevic22:05:34

it’s defined on the namespace level

mihaelkonjevic22:05:49

so it’s global to everything

gadfly36122:05:49

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

mihaelkonjevic22:05:30

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

lewix22:05:51

it's hard to choose

mihaelkonjevic22:05:51

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

roberto22:05:06

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

mihaelkonjevic22:05:40

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

gadfly36122:05:56

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