Knocking Myself Out for Avoiding KnockoutJS
Knockout has been around for a while, but it's taken Don Kiely a while to give it a serious try for rich data binding in client-side applications. But now he's hooked on Knockout!
February 6, 2014
Related: "Ease HTML5 Web Development with jQuery, Knockout, and Modernizr Libraries"
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.
Related: "Using MVVM in JavaScript with Knockout"
All of this is a mildly long-winded way of getting to the point that JavaScript libraries and frameworks is an area where I’m finding it nearly impossible to keep up. There are just too many high-quality tools appearing every day. Some tools are for fairly narrow or specific purposes and others provide a comprehensive framework that support building comprehensive, enterprise-scale applications (I’m looking at you, Angular!) that require significant buy-in to their ways of doing things but with significant benefits if you do. I have my regulars, most notably jQuery, that I use all the time for obvious reasons, but I didn’t spend too much time playing the field. And if I didn’t have resources like John Papa’s blog, as well as Dan Wahlin and his new Web Weekly newsletter, then I probably wouldn’t have a clue about what’s new and upcoming.
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.
Clearly, I need to pay more attention to what’s happening with JavaScript frameworks and libraries, particularly since I spend an awful lot of my time these days writing JavaScript, mostly for client applications. I see a lot of momentum continuing for Google’s AngularJS, so I think that one is next on the list to see if I can buy into its way of building applications. In the meantime, I’m going to be making a lot of use of Knockout.
About the Author
You May Also Like