Thoughts from the Wet Coast

The musings of an ASP.NET Developer from Canada's We(s)t Coast

It's a Knockout: 1 - An MVVM JavaScript Framework

Category: JavaScript
Tags: knockout
Last Modified: May 2 2017
Jul 6 2013

Knockout_01“It’s a Knockout” – a phrase often heard at boxing matches.  Or for those who remember 70’s and 80’s European TV shows, it was the name of a BBC television game show (It’s a Knockout or Jeux Sans Frontiers), also memorialized in the Peter Gabriel song “Games without Frontiers”. 

Well now it’s the title of a new series of blogs I have decided to create describing the awesome MVVM style JavaScript framework, knockout.js.

There are two goals in this series of blogs – to provide information for readers who want to use the knockout framework in their web applications, and more specifically to describe how DotNetNuke is using knockout to build Single-Page-Application style modules.

Knockout was created by Steve Sanderson – who works for Microsoft on the Azure Platform and Tools Team – and who just happens to live in Bristol, where I grew up – not that that has anything to do with why I like it. 

MVVM_RelationIt is an MVVM style framework for developing rich client side applications – but what does that mean?

Developers who have done any work in Silverlight or for Windows Phone will be familiar with (or at least aware of ) the pattern as it is quite often used on those platforms.

The pattern was developed within Microsoft for XAML applications and is a variation of the “Presentation Model” pattern optimized to leverage some of the core capabilities of Silverlight and WPF such as 2-way data-binding, commands and behaviors.

MVVM – stands for “Model – View – View Model”

  • Model – the domain model or business logic of the application
  • View – the UI and UI specific logic
  • View Model – manages the Presentation logic and state

The View Model sits between the domain model and the View in much the same way as the Controller in MVC or the Presenter in MVP, such that the View should know nothing about the Model and vice-versa.

In the next post I will introduce the knockout framework itself and show how it allows developers to implement the MVVM pattern.

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Categories

Tags