As someone who's nominally supposed to be on the bleeding edge of technology and has got the scars to prove it, sometimes I’m a little slow to adopt new technologies. Many years ago, I truly was a technology generalist, at least in the Microsoft world. I was familiar enough with different technologies that I could jump into client projects with some measure of confidence and competence. I also helped write numerous articles in several different journals on those technologies. This career strategy was inspired by my uncle John R. Kiely, who back in the day was a senior executive with Bechtel Corporation, an international engineering and construction company. Over a campfire on a long backpacking trip in the Sierra Nevada mountains in my youth, he said that one of his secrets was to know a little about everything in civil engineering, so that when a client needed help with something, then he could quickly get up to speed on the details of that one thing and provide great service, seizing opportunities when they appeared.
But I’m afraid that those days are long behind me. Staying completely current in the Microsoft world might be considered impossible for any one person or a small talented team. So the last few years I’ve mostly focused on my core competencies, which include web and database development, and even that niche is hard to keep up with.
That’s why I missed out on learning and using Knockout for so long. Sure, I was generally aware of it and tiptoed around it in new ASP.NET web project templates that included it, but until too recently I hadn’t done anything meaningful with it. Partly this was because I was seduced first by jQuery templates and their successors-apparent, JsRender and JsViews. Alas, the jQuery Foundation cut loose on templates a while back, and JsRender and JsViews seem to have lost steam. So when I started a new project recently, I decided it was time to give Knockout a try. And very soon kicked myself for taking so long to give it a try in a real project!
I’m a big fan of using MVC for web applications, so it took a little time to resort my brain cells and get my head around the MVVM (model-view-view model) used in Knockout. MVVM is certainly not new with Knockout, but my experience with it has been fairly limited so far. But as I studied the documentation and explored the interactive samples on the project’s website, I quickly started to appreciate just how elegant this solution is for binding data to HTML elements and templates. Knockout most certainly has a learning curve to it, but I’m pleased with just how logical it is put together and I love how easy it is to use with jQuery. It has rich support for various kinds of bindings, so you can bind data for display and editing, as well as to customize various events and attributes, all of which can implement two-way binding. Once I wrapped my head around Knockout, I just can’t imagine client-side data binding being any easier, flexible, or powerful for data-based applications.