Fork me on GitHub
#ldnclj
<
2016-02-09
>
paulspencerwilliams06:02:43

Static analysis and generative testing interest me greatly.

jarohen08:02:37

morning folks simple_smile

Pablo Fernandez08:02:44

Anybody has a good technique to dispatch on the current route and select different react components with om next? I’m using multimethods wrapping the factories that wrap the react components and it feels a bit too verbose:

Pablo Fernandez08:02:49

(defui AboutPage
  Object
  (render [this]
    (dom/div "This is the about page")))

(def about-page (om/factory AboutPage))

(defmethod layout/pages :about [_]
  (about-page))

jarohen09:02:39

if you don't need open-dispatch, would case/clojure.core.match work?

agile_geek09:02:32

I was thinking core.match too but to be honest not exactly sure how I would implement it without it being reasonably verbose.

Pablo Fernandez09:02:41

@jarohen: I consider that approach, but that would require having a central place to connect page names to react components instead of it being all together next to the page implementation. Now, routing is central, so, I kind of already have that.

Pablo Fernandez09:02:01

(def routes (silk/routes [[:home [[]]]
                          [:tools [["tools"]]]
                          [:tool [["tool" :slug]]]
                          [:about [["about"]]]
                          [:register [["register"]]]
                          [:log-in [["login"]]]
                          [:reset-password [["reset-password"]]]
                          [:change-password [["change-password"]]]
                          [:fail [["fail"]]]]))

agile_geek09:02:18

I've just started looking at om next and it does strike me that there's a bit of 'boiler plate'. Mind, I am used to Spring MVC and JSF so I can't complain!

Pablo Fernandez09:02:47

@agile_geek: it feels more verbose than re-frame so far, but then, it does more.

jarohen09:02:31

@pupeno: yes, although I usually find that I'm already require-ing all of the defmethods in a central place simple_smile

agile_geek09:02:53

@pupeno: I think that was my take away with Om. I suspect trivial SPA's are easier/quicker in re-frame/Reagent but Om/Om Next is probably more scalable?

Pablo Fernandez09:02:28

Yes, I have a core.cljs that requires everything.

Pablo Fernandez09:02:51

@agile_geek: for me, personally, the jury is out on Om Next, but if it’s a positive outcome, I would say that you are correct that re-frame is easier/quicker than Om Next for small SPAs where small is 1 or less API calls to the server, so, very small.

jarohen09:02:04

mm - it's for that reason I usually only use multimethods when someone else (i.e. a downstream library consumer) has to write a defmethod - e.g. same as clojure core's print-method

Pablo Fernandez09:02:16

I wonder if I could have *functions* as the name of the route… muahahaha

Pablo Fernandez09:02:12

Argh… circular dependencies 😞

agile_geek09:02:23

I think it's interesting that we don't have a fairly clear approach to cljs architecture (the Clojure story is a little more mature). I know Om Next is new but there's still a lot of discussion around Reagent and that's been around a while. It's these decisions and...dare I say it, patterns, that make the learning curve steep for experienced dev's coming from another, more mature, environment.

thomas09:02:48

I think my impression is similar.. Om-next seems very complicated… but then I probably don’t understand the problem it tries to solve really.

Pablo Fernandez09:02:16

@agile_geek: I agree that it’s not there and it should be there but I think many devs believe it shouldn’t.

thomas09:02:05

which is something I have never done.

agile_geek09:02:08

@pupeno: I want to explore your idea of getting the 'great and the good' in this area together to discuss what we do about this.

agile_geek09:02:32

If we have this much variability and discussion about how to build a SPA what is the story like on cross cutting concerns, like security for example. I love the variation of opinion in the community but I don't think it helps someone who just wants to ship software

Pablo Fernandez09:02:01

One of my vague plans is to find a pattern that I’m happy with, it was re-frame but then I notice some problems that Om Next promises to solve and once I find the pattern, add it to luminus, so doing lein new luminus projectx +spa will get you started.

xlevus09:02:09

I like re-frame for its simplicity. But the lack of multiple event handlers (which may be intentional on their behalf, and could probably be solved with a bit of scaffold yourself) is slightly annoying.

xlevus09:02:29

Om's cursors are weird.

agile_geek09:02:58

@pupeno: I'd like to talk about how we get something like that established. Do we stick our heads above the parapet and write a series of blogs on 'patterns'? I'm sure we will get plenty of rotten tomatoes thrown our way!

Pablo Fernandez09:02:12

@xlevus: re-frame’s developer is very approachable and open to improvements. We implemented together a hook function in re-frame to integrate with my own Prerenderer library.

Pablo Fernandez09:02:23

@xlevus: Om Next doesn’t have cursors.

xlevus09:02:33

yeah, haven't looked at om-next.

agile_geek09:02:16

Yeah, I quite like that Om Next has ditched cursors as I struggled with the concept. It seems to be a simpler query/pattern matching approach now?

Pablo Fernandez09:02:34

@agile_geek: I don’t think you can move forward in this direction without writing code. You can explore the ideas with blog posts to invite criticism and improve them, but you can also improve code over time. And I can take the rotten tomatoes 😉

agile_geek09:02:25

@pupeno: I agree. I would not suggest we talk about it in the abstract. Need, probably several iterations, of code to prove it.

mccraigmccraig10:02:21

@xlevus: what dyu mean with "the lack of multiple event handlers" in re-frame ?

xlevus10:02:37

You can only have one handler bound to one event afaik.

mccraigmccraig10:02:06

oh, i see - you are thinking pub/sub...

mccraigmccraig10:02:13

you would need some way of specifying a priority list for handlers of an event then... i can see why they stuck with a single handler

paulspencerwilliams10:02:52

You can bind multiple subscribers to a subscription can't you? Would you not have one event from source to app state, and multiple on way back up?

paulspencerwilliams10:02:16

Maybe I'm being naïve, only created a fairly noddy app with it.

xlevus10:02:10

That's probably the right way to do it

progzilla20:02:29

@agile_geek: just want to ask. are we going to ever something like for ClojureBridge for the male gender? Sometimes its not so easy for some beginners to learn from the dojos..just saying..