Steve Sanderson, creator of Blazor, writes about .NET, JavaScript frameworks, Knockout.js, and web application architecture.
HN links it for Blazor desktop alternatives to Electron, Knockout.js and JS framework comparisons, and his view on selective unit testing.
The situation with packages and dependency hell today is horrendous, particularly if you work in a highly dynamic environment like web development.
I want to illustrate this with a detailed example of something I did just the other day, when I set up the structure for a new single page web application. Bear with me, this is leading up to the point at the end of this post.
To build the front-end, I wanted to use these four tools:
- jQuery (a JavaScript library)
- Knockout (another JavaScript library)
- SASS (a preprocessor to generate CSS)
- Jasmine (a JavaScript library/test framework)
Notice that each of these directly affects how I write my code. You can install any of them quite happily on its own, with no dependencies on any other tool or library. They are all actively maintained, but if what you’ve got works and does what you need then generally there is no need to update them to newer versions all the time either. In short, they are excellent tools: they do a useful job so I don’t have to reinvent the wheel, and they are stable and dependable.
In contrast, I’m pretty cynical about a lot of the bloated tools and frameworks and dependencies in today’s web development industry, but after watching a video[1] by Steven Sanderson (the creator of Knockout) where he set up all kinds of goodies for a large single page application in just a few minutes, I wondered if I was getting left behind and thought I’d force myself to do things the trendy way.
About five hours…
Especially considerring Knockout Model plugin that basically adds Backbone-style capabilities to KO models. Other notable plugins give easy bindings for jQuery UI widgets, Underscore support for collections and external templates:
https://github.com/SteveSanderson/knockout/wiki/Plugins
I'd also like to point out that in the upcomming release Knockout ads several nifty improvements: http://blog.stevensanderson.com/2011/08/31/knockout-1-3-0-beta-available/
My favorite are control flow bindings that let you write templating code right inside your HTML and not withing script tags. When you have to write markup inside a script tag you editor might get the whole autocompletion, formatting and syntax coloring wrong. And in past it was relly annoying for me. So having templates in HTML, not in script is really great.
One thing that helps a lot is that all bindings are defined inside data-attributes which keeps markup valid. Most editors support them well, too. Ember's double-braced template attributes are really weak choice in this regard.
And if you're worried about javascript bits inside data-bind attributes you now have an option to separate them via binding providers (see blog post above). The syntax is somewhat clunky but still workable and I suppose it can be improved.
Provided that Knockout has a vibrant community and growing support inside .NET world I think Ember has nothing to offer to make me switch.
And that's unfortunate. Today I see like most frameworks…
I recommend checking out http://blog.stevensanderson.com/2012/08/01/rich-javascript-applications-the-seven-frameworks-throne-of-js-2012/ for a more in depth exploration of the trade-offs between the popular client-side architecture tools.
I can only speak of my personal experience with these tools, and I've only tinkered with knockout (though we do use it for one of our tools internally, and the developer of that project gave it glowing reviews). I would recommend using the tool that is the closest to your development style.
If you like opinionated frameworks that make it as easy as possible to do the most common tasks (like rails), maybe you'd enjoy something like ember.js (or knockout). For me the style closest to home is the ability to plug in My Favorite Solution to each particular problem as it arises.
A primary offering from backbone then is a simple structure for plugging all these previously disparate tools together, the serverside corollary to this is something like python's Flask or ruby's Sinatra where it comes with only a simple routing base and ways to plug your own components in.
Want to use your own templating library? Easy. Want to use your custom persistence style? No problem. Backbone isn't going to make these choices for you, you will need to make them yourself.
This may or may not be the right choice for you, just investigate and make the choice that makes the most sense for you !
As far as IDE's I have found JSLint in jsfiddle.net (http://jsfiddle.net/shaydoc/geQvz/) handy, else I've just got reacquainted with the javascript way and been developing in notepad. Google Chrome has fantastic developer tools as already mentioned! debugging is a sinch and console.log is brilliant!
Framework wise, I am loving http://Knockoutjs.com, its an MVVM design style, similar to the pattern frequently used for Silverlight development, and its got great tutorial and support on the site. I particularly like the Knockout mapping plugin as it will automatically map JSON into a ViewModel, sweet!
Checkout the author Steve Sanderson's blog also, well worth reading : http://blog.stevensanderson.com/
I have been getting familiar with http://amplifyjs.com which simplifies ajax request management and client side storage, as well as a publish/subscribe messaging.
Also recently stumbled upon http://xuijs.com/ which I intend to get more familiar with!
Good luck with your ventures in javascript!
It seems that the criticisms keep switching between ASP.NET and ASP.NET MVC interchangeably. If you are primarily speaking about MVC, I think there is definitely some misinformation here.
1. The key term here is "defaults". This behavior is completely configurable.
2. This doesn't apply to MVC, since it is all handler based. Plus, you can extend it at pretty much any point in the pipeline: http://blog.stevensanderson.com/2007/11/20/aspnet-mvc-pipeline-lifecycle/
4. I think this is an older point of view that is rapidly changing with MVC. Outputting custom formats is astonishingly simple, it's a matter of using built-in ActionResults, or inheriting it when creating your own, e.g., YamlResult. When they make the framework more extensible like they have here, I think developers certainly take advantage of that.
I keep seeing a lot of criticism of the default behavior, when all of this behavior is trivially overridden.
You're right, it runs on Node. However as the poster above pointed out, there would be little practical use in combining this with another framework. Meteor is really it's own platform. The whole point is the unification of the client and server codebase.
I'm not sure about Ember, as I believe it tends to be more opinionated about how much of the page it controls, but Knockout and Backbone are generally pretty easy to use for just a portion of the page.
Steve Sanderson (creator of Knockout) has a really good overview of the most popular client side options (both libraries and frameworks).
http://blog.stevensanderson.com/2012/08/01/rich-javascript-applications-the-seven-frameworks-throne-of-js-2012/