Sunday, 5 February 2017

KnockoutJS

Recently I had the opportunity to do some work with this awesome framework. Not like any other JS framework that I have used before.

In the past we all have had the obsession of usually writing two versions of an MVC application both in the front and the back.

Though for me this felt liberating (it just uses data-bind attributes). The front end was all seperate from the backend. Meaning I could replace the backed with whatever technology I wanted (I chose Ruby On Rails) and the application would still work. The caveat is that you generate the same HTML (which should not be an issue, until you redesign). The MVVM pattern is really exciting and can't wait to try it out on other technologies.

It does not lock you into any testing framework. Does not tell you how to get the data from the server (use Backbone or jQuery as examples). Doesn't tell you how to route (I chose Navigo). Having this flexibility for me was so good as I was learning and when I hit an issue I could not solve I could just replace it

The only downside that I found was with testing (as I do all my testing in Cucumber) was that it could not be used with a headless browser (webkit or poltergeist), so you have to use either Firefox or Chrome with selenium-webdriver. I am sure that this will get better.

Highly recommend learning it and it has great support online. If you get some time check it out KnockoutJS and its great tutorials.

No comments:

Post a Comment