Live data from Hacker News

Why We Use Om, and Why We’re Excited for Om Next

blog.circleci.com

11–20 of 74 posts

Re: Why We Use Om, and Why We’re Excited for Om Next

#11
post #3

So I've been looking at Elm recently, what would the advantages/disadvantages for something like Elm over Om/Om Next?

Elm's HTML engine conceptually the same as React+Redux and Om Now. It's just a big single atom app state with ways to describe how to update it. It has all the same problems as Om Now (maybe not quite as bad because it doesn't have cursors, but it doesn't solve the data-as-a-graph problem).

Ok I see now. I think both methods have a place going into the future.

What I've understood from Relay/Falcore/etc. is those technologies are great for something like Facebook or Netflix, hence why they made the frameworks, but for many other cloud/web apps, it may not make sense. A single atom app state works really well. Is that along the lines of the right thinking? I'm using React+redux along with websockets and haven't had any problems with large state trees, but the whole state can be sent to and from the server very fast as it's not too big.

I'm sure Elm will have something comparable to Om Next/Relay/falcore as well then, to solve those use cases.

Re: Why We Use Om, and Why We’re Excited for Om Next

#12

I would love to see some code examples of this part "If we try to show a component that needs to know the current user’s initiated builds, that triggers an API call that asks the server for the data. If we stop using that component, we stop making that request. Automatically." I'm currently knee deep in a react/redux implementation, which I guess is quite similar.

There's a basic start to a remote syncing tutorial here: https://github.com/omcljs/om/wiki/Remote-Synchronization-Tut...

Basically, you specify a query as a remote query and it calls a `send` function that you specify, and you manually pass the query to the server to execute, which will return results and automatically be merged into the app state (and of course, re-render components that depend on that query).

For the part where they stop making that request, they must do custom lifecycle code so that when the component unmounts, they are able to access current open requests (probably indexed by component manually) and cancel it. That part is not builtin to Om Next.

Re: Why We Use Om, and Why We’re Excited for Om Next

#13

Earlier quoted context omitted.

Elm's HTML engine conceptually the same as React+Redux and Om Now. It's just a big single atom app state with ways to describe how to update it. It has all the same problems as Om Now (maybe not quite as bad because it doesn't have cursors, but it doesn't solve the data-as-a-graph problem).

Ok I see now. I think both methods have a place going into the future. What I've understood from Relay/Falcore/etc. is those technologies are great for something like Facebook or Netflix, hence why they made the frameworks, but for many other cloud/web apps, it may not make sense. A single atom app state works really well. Is that along the lines of the right thinking? I'm using React+redux along with websockets and…

I don't think it's that's simple. It's not that it works better for hugely complex apps. It just works better for certain kinds of apps, even if they are small. The project I'm working on is small, but Om Next is far better suited to it (the complexity of using Redux+Redux/etc on it would be far greater).

The question is, are the majority of apps better suited for a tree-based state or a queryable graph? I'm not sure, but it's at least even.

I've heard Elm is working on something similar, so I wouldn't be surprised if that happens.

Re: Why We Use Om, and Why We’re Excited for Om Next

#14

> Application state as a single, immutable data structure. react-cursor gives this pattern in javascript, immutability and all, but with regular old javascript objects. It also comes with all the same caveats as in this article. (I don't speak for the creator of Om, I speak for myself as the author of this library which was inspired by Om and Clojure) https://github.com/dustingetz/react-cursor/ The beautiy of the sta…

> Solving this impedance mismatch

The solution seems now to get rid of the REST paradigm(GraphQL ...).

While I have no opinion on what should be the right solution, I welcome the idea of questioning the usefulness and the significance of REST, especially in the era of fat web clients.

Re: Why We Use Om, and Why We’re Excited for Om Next

#15
post #14

> Application state as a single, immutable data structure. react-cursor gives this pattern in javascript, immutability and all, but with regular old javascript objects. It also comes with all the same caveats as in this article. (I don't speak for the creator of Om, I speak for myself as the author of this library which was inspired by Om and Clojure) https://github.com/dustingetz/react-cursor/ The beautiy of the sta…

> Solving this impedance mismatch The solution seems now to get rid of the REST paradigm(GraphQL ...). While I have no opinion on what should be the right solution, I welcome the idea of questioning the usefulness and the significance of REST, especially in the era of fat web clients.

My opinion is that REST is exposing the O/R impedance mismatch to the client, and we are only feeling this now as our client apps get really complicated, and i think the O/R imnpedance mismatch is caused by pervasive mutability, and i think the problem can be solved by making the database immutable (e.g. CQRS/ES, Datomic), and i think that will make the problems with REST go away too. (This is not quite what GraphQL is trying to do, GraphQL is progress but doesn't get to the crux of it) This is all research of course, and completely my opinion. Om Next is meant to be paired with Datomic so while his solution is to throw away everything that is even a little bit RESTy, i think that might be throwing the baby out with the bathwater. time will tell.

Re: Why We Use Om, and Why We’re Excited for Om Next

#16
Our team used Om for our app (balboa.io) for the first 3 months of development. We switched to Reagent and have been using that for the last 8 months.

We ran into the same problems with Om as the CircleCI guys, specifically: 1) our front-end data model wasn't complex enough to merit a heavy-weight data access system that required a huge amount of extra digging to get right. We spent far too much time arguing about how to structure app-data, and it only got worse as the app got more complex. The cursor system in its first iteration was just too cumbersome (for exactly the reasons this author states). We kept trying to restructure the data model in order to get it to do what we needed. To be fair though, this is well known, and David Nolen has done a lot to alleviate this in recently releases (ironically by making it more Reagent-like). 2) our app is end-to-end encrypted and requires pulling down potentially hundreds of blobs, decrypting them, and inserting them into the dom. Under these conditions, Om would kick it and the UI would grind to a halt.

We switched to Reagent, and found that it was far faster and "got out of the way" of development. Add-watch is amazing too. Our app is quite large (front end SLOC is around ~50k lines), and Reagent has scaled beautifully and is a beast at large-scale insertions (on the order of 1000).

Om has some delightful features (undo ability is very powerful, routes coupled with Secretary is also great for Om), and David Nolen is a genius, but I think even the author has to acknowledge that the app-data/cursor construct is more of a pain than it's worth...

Re: Why We Use Om, and Why We’re Excited for Om Next

#17
I really like David Nolen as a conceptual visionary. His work with Om and core.logic is great and has inspired a lot of derivative work. But I would never rely on his libraries in production. It seems like he always gets to 90% before moving on to the next new thing. 90% documentation, 90% cljs->js coverage, 90% tested, 90% issues addressed. I wouldn't touch Om unless I was willing to employ at least one person to work on Om full time.

Re: Why We Use Om, and Why We’re Excited for Om Next

#18
> Most data is not a tree

This is huge. I think it might even be the single largest problem to most projects' progress. I've seen a lot of projects that have tried to force non-tree data into tree-structures, and it never works out well. Projects grind to a halt after 6 months to a year because nobody can keep track of the dance steps they have to do with the tree-oriented code to manage their graph-oriented data.

Real, actual tree structures are just incredibly rare. Even some things that "obviously" seem like they should be modeled as a tree are far better off as a directed graph. Like databases of family trees - it's possible someone is literally married to their sister! Less cringe-worthy examples involving large families living near other large families with generational overlaps causing the children of one group marring the grand-children of the other, and vice versa.

You don't really need React. If you can do the ostensibly hard work of figuring out the DOM edits yourself, your app will actually be faster than if you're using React, i.e. React has its own overhead. As long as the data relationship was right, I've never found it difficult to manage state thereafter. It's when the shoe doesn't fit that things become a problem.

The problem is, we have a systemic problem of treating front-end devs as not "real" developers, not capable of forging their own paths. It's not just from the outside-in, I see a lot of front-end devs lacking a lot of confidence in their own skills. As a culture, we yell at any JavaScript programmer going his or her own way, building their own thing. "Don't reinvent the wheel!" they are told. Screw that. I can think of at least 3 times off the top of my head that the wheel itself was significantly and usefully re-invented in the 20th century alone. The problem is not "reinventing wheels". The problem is this institutional fear of making ones own decisions, leading people to think they need to learn everything.

Re: Why We Use Om, and Why We’re Excited for Om Next

#20
We could throw out the entire list and rebuild it in one go, but re-rendering large amounts of DOM is also slow.

Oh really?

Here is how we gonna do. I will start by saying, no it isn't and you we will try to convince me that it is slow. You gonna have to be convincing because I'm pretty sure one can render a full webpage on a 1080p display at 60Hz (yes, I mean render it 60 times a second).

This is a real question. Aren't we?

Post reply on HN