GundersenMarius's comments

GundersenMarius | 12 years ago | on: Knockout v3.0.0 released

I looked at the source code for jQuery Ajax, and saw that it is basically a wrapper for the xmlhttprequest object. So I made my own wrapper, one where I don't have to specify the same parameters every time.

But the solution we use is something completely different which is hard to explain in a single post. It is based on CQRS and provides not only a way to communicate with the server, but validation of parameters. This works very well with Knockout observables, since you can create an object once and then execute it multiple times, when the observables have changed.

GundersenMarius | 12 years ago | on: Knockout v3.0.0 released

I'm both a frontend and backend developer, and I love knockout.js. I want to reply to some of the issues you brought up, not just for you but for others as well.

1) the pendulum is currently swinging backwards from the "no logic in the HTML" and is heading towards the "all logic in the HTML". Knockout, angular and ember all use declarative bindings, which is the complete opposite to what jQuery code was like. I think it is a good idea, as it makes it easy to understand how a dom element is supposed to behave. But the pendulum will probably swing back in the other direction again in a few years, and somewhere in the middle is likely the optimum.

2) fromJS and fromJSON are dangerous and should be avoided. It might be more work to manually write things out field by field, but it makes things a lot easier to debug and understand later on (just like data-bind makes interactive dom easier to understand than jQuery magic). Easy to write does not equal easy to read or maintain.

3) jQuery should be forbidden in a knockout.js project, except (maybe) inside custom bindings. This does make some things which are easy with pure javascript difficult, and that is unfortunate. I still haven't found a good solution to this.

4) shameless plug: I'm working on a framework which solves this, called ordnungJS (http://ordnungJS.com) it is not well documented yet, but I have used it in production code and it works well. I'll improve the documentation when it reaches a more stable version, and write a short tutorial on how to use it.

page 1