KnockoutJS Needs a Better Set of Tutorials
- javascript
- opinion
- Thursday, August 18, 2011
Good Lord Above I am going out of my mind with these "tutorials" that murder javascript at the alter of KnockoutJS. It's a dandy little tool - one that apparently leads people to get drunk on HTML Markup, causing them to puke javascript out their noses and into their examples.
Code Blue Dr. Sanderson
Look, I really like KnockoutJS and I love me some Steve Sanderson. This isn't about it and him - it's about what people are doing with the stuff he's made.
I saw a link today (I think it was from that Elijah Guy ) and that takes me off to Net-Tuts (I don't know how to write nor say that name) t where I see this:
I copied/pasted the code into TextMate as it didn't even fit on the page of the article and I wanted you to bask in this... tutorial.
Look, there are much better ways to write KnockoutJS. Like any language and framework - Javascript with Knockout takes some discipline and effort to make it palatable and understandable. With this kind of "tutorial", however, you're confusing people and throwing a bucket of puke on an otherwise elegant, capable framework.
I seem to recall a lot of people, some rather vocal ones at that, getting torqued with the idea of "Spaghetti Code" all over their lovely views. If you ask me - the image you see above is PRECISELY the definition of Spaghetti Code:
Spaghetti code is a pejorative term for source code that has a complex and tangled control structure, especially one using many GOTOs, exceptions, threads, or other "unstructured" branching constructs. It is named such because program flow tends to look like a bowl of spaghetti, i.e. twisted and tangled.
Am I wrong? Cause I see this everywhere.
Fixing This
The people who write these tutorials need to be held to a higher standard. I tried to use Knockout with the MVC 3 series at Tekpub - but I didn't understand it's idioms enough to do it justice, so I left the whole thing out.
You have to have a trigger - some kind of little demon in the back of your geek psyche that says "hey wait a minute - this looks like utter shit!". For some reason, every Knockout demo/example/SO Answer I've seen (of course, outside of Steve's stuff) just does not measure up.
What I really think needs to happen is a section on the Knockout Tutorial site that focuses on writing clean, maintainable code with the framework.
Then, perhaps one of the committers (Ryan?) could add a "canonical" example that people can learn from. Yes, To-do lists are over-blown but it might help to write the the Backbone To-do List example so people can compare point-by point. I would volunteer, but as I said, I don't think I would do Knockout justice.
Thoughts?
-
- Tweet
-