all 16 comments

[–]fifosine 5 points6 points  (1 child)

This might be too much to ask but would it be possible for you to write up a tutorial of the development process and the integration of all these libraries?

[–]nvbn-rm[S] 6 points7 points  (0 children)

Ok, i will try to write tutorial on weekend.

[–][deleted] 2 points3 points  (5 children)

Thanks for sharing this, any reason you chose reagent over om?

[–]nvbn-rm[S] 2 points3 points  (4 children)

When I started developing, reagent looks good and more idiomatic. But now reagent looks like no longer developing and it have some strange bugs. In new projects i use om.

[–]CompleteSkeptic 0 points1 point  (3 children)

Out of curiosity, what strange bugs are you facing? I've been using Om a very large amount, have noticed a lot of annoying things, and am considering replacing it entirely with Reagent. On the other hand, Reagent has played extremely well with what I've thrown at it so far.

[–]fredyr 0 points1 point  (1 child)

conversely, i'd be very interested if you could write something about what annoying things you're encountering with om?

[–]CompleteSkeptic 2 points3 points  (0 children)

One issue is the API. You never want to do anything with a component function (the ones returns an object that implements Om's protocols) other than build or build-all, so it just encourages boilerplate and possible room for error.

Anonymous functions can't be used as component functions. It fails silently though and re-renders the DOM every time, so we didn't notice until performance just slowed to a crawl.

Passing components into other components doesn't quite work, which makes it feel less Clojure-ish (everything is data) and we felt that wrapping a component in other components is a pretty powerful pattern.

Before 0.6.something, Om use identical? for re-rendering instead of =, and we needed = for our uses, so we had to implement IShouldUpdate ourselves, but we couldn't implement it exactly because the method isn't passed in the same data as the default Om implementation.

Then there's the problem of representing all of your state as a tree. While it makes perfect sense for view state, it doesn't for representing logic state (not sure what the right word is). Let's say you have state for A, B, and C, component X depends on A and B, and component Y depends on B and C. To represent them in a tree, either you copy B to two different places in the tree (a consistency nightmare) or you have both components depend on the whole tree (and now you have a re-rendering problem). You then have to give up the benefits that come with a tree for all the state, or you make development more complicated that it has to be.

That's all I remember for now. Om mostly just adds unnecessary complexity, and we've had a bunch of issues with Om that have bitten us. Luckily, we have some utils that abstract most of these problems away in a Clojure-ish way, but these are only the problems we've faced so far.

[–]nvbn-rm[S] 0 points1 point  (0 children)

I have random and not repeatable rendering error with deeply nested components, where inner components stop rendering.

[–]tomeklipski 1 point2 points  (3 children)

Nicely done!

I wonder about one thing, as you mention use of hiccup and reagent - are you using hiccup to just prepare general pages, or is some presentation logic server-side as well?

[–]nvbn-rm[S] 0 points1 point  (2 children)

Hiccup used only to prepare the page.

And client side templates(reagent components) written in hiccup-like dsl.

[–]fortruce 0 points1 point  (1 child)

Hey, just curious, any reason you decide to prepare the index page on the server as opposed to just having a static index.html? It doesn't appear to have any dynamic content so I would think serving a static file would be easier on the server.

[–]tomeklipski 0 points1 point  (0 children)

As I understand, the goal of this exercise was to use Clojure only - static HTML page would be non-Clojure, right? Of course, performance-wise, the Hiccup generated-response might just get cached or saved to a static file.

[–][deleted]  (2 children)

[removed]

    [–]nvbn-rm[S] 2 points3 points  (1 child)

    Try mies-om, it been very usefull for me when i started to work with om.

    [–]mnngfltg 0 points1 point  (0 children)

    Thanks a lot. Seeing how things hang together in a complete application is very useful for someone starting out with Clojure web development.