I have used different JavaScript libraries and frameworks in my web applications over the years. Notably, ExtJS, jQuery and Kendo UI. This year I decided to use Knockout, a library that seems to have fallen out of favor with developers lately, in production projects.
I have used Knockout in three projects now and I have to say I am very pleased with the results. In this article I will highlight a few things I like about the library.
Easy to Adopt
Knockout is concerned mainly with data binding of html elements. It isn’t an application framework with built-in components and prescriptions on how to implement any specific application feature. As a result, it has few concepts to learn, and it offers developer flexibility on what “recipes” to use to implement any features in an app.
Partly because of the library’s simplicity and small size, its documentation is short and it has good examples. Besides the official documentation, there are many online examples and extensions created by the developer community.
Flexibility
Beyond the data binding of html elements, the library doesn’t prescribe how you have to do things in a web application. It allows you to use any UI library/theme to create the visual elements, or code them by hand. It also allows you to implement other logical layers, such as validation and communications with the server, any way you like.
If you are a developer who prefers application frameworks with built-in data grids, charts and other visual components, you might see this flexibility as a disadvantage. You also have to consider the economic aspect of the project – what is more costly, hand-code and maintain the UI elements, or learn and maintain a framework with built-in UI components?
Stability
Knockout has been around for a while, and it’s not changing frequently as other libraries and frameworks are. I particularly prefer to use the frameworks that change very little over time. My team works in projects where it’s important to minimize time spent re-learning a library or fixing braking changes introduced with new versions.
What About You?
Which JavaScript libraries or frameworks do you use in your web application projects? Do you prefer small, limited-purpose libraries or large do-it-all frameworks?