Live data from Hacker News

The Future of JavaScript MVCs

swannodette.github.io

141–150 of 159 posts

Re: The Future of JavaScript MVCs

#141

Earlier quoted context omitted.

That's exactly what we encourage :) composition of higher level components that render down to other high level components that eventually render to (virtual) DOM.

I wonder if this approach would work with visual XML (Docbook) and HTML editing, where resulting DOM can be complex and large. Competent writer might generate loads of input (writing 100 letters per minute, copy-paste). If my writing tool has latencies, that annoys me far more than game latency. Other approach I have been testing is contenteditable, but this won't work with virtual DOM at all. Though how you parse an…

We could do that probably. Would need your own parser

With content editable we can just parse he html. We have an example in the repo.

Re: The Future of JavaScript MVCs

#142

Earlier quoted context omitted.

I wonder if this approach would work with visual XML (Docbook) and HTML editing, where resulting DOM can be complex and large. Competent writer might generate loads of input (writing 100 letters per minute, copy-paste). If my writing tool has latencies, that annoys me far more than game latency. Other approach I have been testing is contenteditable, but this won't work with virtual DOM at all. Though how you parse an…

We could do that probably. Would need your own parser With content editable we can just parse he html. We have an example in the repo.

> We could do that probably. Would need your own parser

Parser for HTML and XML to generate React components and generate virtual DOM from that? This got me thinking.

> With content editable we can just parse he html. We have an example in the repo.

It must be the weekend denseness setting in... I grepped through React repo, but I just found bits in the core that had something to do with content editable. Could you perhaps point me to right direction? If I understand this correctly, I could parse the entered HTML to virtual DOM.

Re: The Future of JavaScript MVCs

#143

Earlier quoted context omitted.

We could do that probably. Would need your own parser With content editable we can just parse he html. We have an example in the repo.

> We could do that probably. Would need your own parser Parser for HTML and XML to generate React components and generate virtual DOM from that? This got me thinking. > With content editable we can just parse he html. We have an example in the repo. It must be the weekend denseness setting in... I grepped through React repo, but I just found bits in the core that had something to do with content editable. Could you p…

Check this out: https://github.com/facebook/react/pull/667

Re: The Future of JavaScript MVCs

#144

This is like a dream coming true. I don't like Javascript's quirks, nor programming DOM with templates nor functions. I'm looking to build somewhat complex UIs without having to think in JS and manage state. React absolves me from DOM and ClojureScript keeps JS at bay. Only if starting ClojureScript development wasn't so hard. I'd like to use browser REPL, IDE like LightTable. I am used to LiveReload's speed which ma…

I don't think ClojureScript could become popular beyond a subset of Clojure users unless it becomes self-hosted, so it can be compiled without a JVM and eval in a browser with an extension. The JVM is not universally loved/acceptable. I keep meaning to make a game with it, but always give up because it's so much more painful than pretty much any other to-JS language.

That might be, but it's young yet. Just seeing its ideas (or general functional programming in general) getting more widespread, like React here, feels good to me. I have more pain points with JS. I'd rather deal with build difficulties than have to handle DOM state, evented programming and JS quirks.

Re: The Future of JavaScript MVCs

#145

Earlier quoted context omitted.

> We could do that probably. Would need your own parser Parser for HTML and XML to generate React components and generate virtual DOM from that? This got me thinking. > With content editable we can just parse he html. We have an example in the repo. It must be the weekend denseness setting in... I grepped through React repo, but I just found bits in the core that had something to do with content editable. Could you p…

Check this out: https://github.com/facebook/react/pull/667

Sweet! Thank you very many. Learnt a lot today :)

Re: The Future of JavaScript MVCs

#146

I've been watching Clojure for a while, and I love the spirit of this work. However, as a framework author, I feel obliged to point out that of course you can create a more expressive and performant UI framework in a language with S-expressions, macros, and value semantics. What's hard is doing it in JavaScript. :) It also feels a bit like reverse logic to cite ever-faster JavaScript VMs as a reason to choose a new f…

The main features David talks about in the post are available in vanilla JavaScript:

> If you're a JavaScript developer, I think taking a hard look at React is a really good idea. I think in the future, coupling React with a persistent data structure library like mori could bring JS applications all the way to the type of flexible yet highly-tuned architecture that Om delivers.

I think there are a couple reasons Mori and other libraries like it haven't caught on in the JS mainstream:

1. It's clunky to use them in vanilla JS compared to the default mutable objects and arrays. While you gain simpler semantics, the code becomes harder to read, and that tradeoff isn't always worth it.

2. Most JS developers are not experienced with building programs around immutable values.

Re: The Future of JavaScript MVCs

#147
post #131

Earlier quoted context omitted.

I don't see how language has anything to do with you criticism.

It's not really about a choice of language. My point is that if Om claims to be superior to other JS MVC frameworks - as it is presented as "the future of MVC frameworks" - it needs to be good (if not superior) in many aspects. Performance is a big deal all right, but another aspect (which seems essential to me) is that using this framework should be easy, concise and intuitive. And I've been kinda disappointed to se…

This sounds like a case of simple, not easy: http://www.infoq.com/presentations/Simple-Made-Easy

You could add a timestamp to each todo with two changes:

https://github.com/swannodette/todomvc/blob/gh-pages/labs/ar...

    (defn handle-new-todo-keydown [e {:keys [todos] :as app} owner]
    ...
            (om/update! app [:todos] conj
              {:id (guid) :title (.-value new-field)
               :created-at (js/Date.)  ;; 
https://github.com/swannodette/todomvc/blob/gh-pages/labs/ar...

    (defn todo-item [{:keys [id title editing completed] :as todo} {:keys [comm]}]
    ...
                ;; change this line
                (dom/label #js {:onDoubleClick #(handle-edit % todo m)} (str
    (:title todo) (:created-at todo)))
    ...)

Re: The Future of JavaScript MVCs

#148
post #119

Earlier quoted context omitted.

React does the diffing on the output (which is a known serializable format, DOM attributes). This means that the source data can be of any format. It can be immutable data structures and state inside of closures. The Angular model doesn't preserve referential transparency and therefore is inherently mutable. You mutate the existing model to track changes. What if your data source is immutable data or a new data struc…

So, maybe i'm misunderstanding, but, the perf advantage is that react waits until the next RAF and then only updates the parts of the DOM that actually changed? So, now i'm wondering: why can't the browser do that? Isn't this whole middle-man approach something to eventually be optimized out?

Sure, the browser could implement a virtual dom and then sync it and do a reflow once per frame.

Re: The Future of JavaScript MVCs

#149
post #146

I've been watching Clojure for a while, and I love the spirit of this work. However, as a framework author, I feel obliged to point out that of course you can create a more expressive and performant UI framework in a language with S-expressions, macros, and value semantics. What's hard is doing it in JavaScript. :) It also feels a bit like reverse logic to cite ever-faster JavaScript VMs as a reason to choose a new f…

The main features David talks about in the post are available in vanilla JavaScript: > If you're a JavaScript developer, I think taking a hard look at React is a really good idea. I think in the future, coupling React with a persistent data structure library like mori could bring JS applications all the way to the type of flexible yet highly-tuned architecture that Om delivers. I think there are a couple reasons Mori…

would you mind simply explaining a little more what an immutable value is? I Understand immutable as something that cannot be changed. > all of our collections are immutable How can a collection which is data that eventually ties into a db be unchangeable?

Re: The Future of JavaScript MVCs

#150
post #146

I've been watching Clojure for a while, and I love the spirit of this work. However, as a framework author, I feel obliged to point out that of course you can create a more expressive and performant UI framework in a language with S-expressions, macros, and value semantics. What's hard is doing it in JavaScript. :) It also feels a bit like reverse logic to cite ever-faster JavaScript VMs as a reason to choose a new f…

The main features David talks about in the post are available in vanilla JavaScript: > If you're a JavaScript developer, I think taking a hard look at React is a really good idea. I think in the future, coupling React with a persistent data structure library like mori could bring JS applications all the way to the type of flexible yet highly-tuned architecture that Om delivers. I think there are a couple reasons Mori…

That's true, on all counts.

Meteor could use Miro inside minimongo on the client, for example, and turn objects into vanilla JS before passing them to the app, if that implementation offered significant performance benefits (or equal or better performance and cleaner code, though the size of the Miro payload would also have to be weighed). Once the app has to deal with Miro objects, though, it starts to feel less like the JavaScript people know.

Post reply on HN