TDG Talk - JavaScript MVVM
Tonight I had the opportunity to share some of the foundations of what I've learned for building rich web applications using JS and the concepts around MVVM.
Downloads
The complete Visual Studio solution (ready to run) (ZIP)
The slide deck (PPTX)
Links
Knockout
JS for C# Developers
Crockford's JavaScript
Q&A
Some great questions - I remembered as many as I could:
How to synchronize changes between the client and server models?
To really take Knockout to the next level, there's a plugin called Mapping which helps reconcile changes to a model, for example updates received from the server.
What is SignalR, and how does it fit in?
SignalR is an open-source .NET library that allows you to create a virtual "socket" connection between the web server and each web browser and communicate via JavaScript events. This is similar to some concepts in NodeJS.
Is there a client validation story like Django?
Not that I know of, unfortunately.
What's the difference between Backbone and Knockout?
Backbone is an MVC framework that orchestrates the data flow between client and server. Knockout is a library of MVVM pieces (observables and bindings). They overlap ever so slightly (and unfortunately conflict with each other), but mostly cover different aspects of the total application story.
What's the difference between Concatenation (aka Bundling), Minification and Compilation?
Concatenation (or bundling) combines all your JavaScript files into one, to reduce network roundtrips. ASP.NET MVC 4 does this.
Minification reduces the size of the file(s) by removing whitespace, comments, and any unnecessary characters. It does not change the execution flow of the code. JSMin is the most well-known example.
Compilation goes one step further and actually compiles your JavaScript down to machine code, then writes it back out to JS in the most minimal way possible. It shortens execution paths, inlines functions, and more. See the Google Closure Compiler for more about this!