News for hackers. Stuff that matters.
Re:How to avoid rewriting your JavaScript application by brlewis on Thursday October 20, 2016 @05:32PM (#12756366)
Using jQuery you can express a UI as a function from Application State to DOM? I'd be really interested in an example. I've only ever used jQuery to do lots of imperative-looking DOM state changes.
Re:How to avoid rewriting your JavaScript application by henriquelimao on Thursday October 20, 2016 @05:55PM (#12756526)
It is not common, easy, efficient or idiomatic, but you can: Imagine that in each event handler, instead of doing something, you just update some state somewhere, and after that call a common "draw" function. Inside the "draw" function you redraw all your UI: apply effects, etc. That's it, you have it.
Re:How to avoid rewriting your JavaScript application by jowiar on Thursday October 20, 2016 @06:01PM (#12756558)
Along these lines, this is why Dan Abramov's Getting Started with Redux[1] is one of my favorite tutorials to anything, ever. The concepts are simple, and half the tutorial is walking through creating a naive implementation of Redux. The actual library, of course, involves performance optimizations and better edge case handling, but at the very least, having a "this is sort of what the innards look like" is a really nice start to approaching anything.

[1] https://egghead.io/courses/getting-started-with-redux

Re:How to avoid rewriting your JavaScript application by daliwali on Thursday October 20, 2016 @05:43PM (#12756450)
The end user doesn't know or care about implementation details. It's bikeshedding that nobody cares about except the developers themselves. Facebook could have built their web app with Angular or Ember or whatever and nobody would give a shit except developers. Even as a developer I don't give a shit about what framework a web app I'm using is made with as long as it works (if it's horribly broken then I know what to avoid).
Re:How to avoid rewriting your JavaScript application by brlewis on Thursday October 20, 2016 @05:54PM (#12756518)
Isn't that like saying I'm not an architect so I don't really care what kind of foundation my house is built on as long as it hasn't fallen down yet? They're all held up by the same laws of physics anyway.