A thought struck me as I was reading a chapter out of Douglas Crockfords book "Javascript: The Good Parts". The chapter was titled "Awful Parts" in reference to the large number of less than desirable features in Javascript.
The chapter is long and scary.
Also, the chapter immediately after is titled "Bad Parts"
Anyway, the chapter put forth a large number of very alarming deficiencies in Javascript. If I didn't depend on it soo much as a web developer then I would almost be tempted to dismiss it altogether and invest my spare time in other languages.
However, given that I do need to use it on an almost daily basis, I had a thought. Given there are soo many dangerous aspects to the language it seems pertinent that we should try to use only as much javascript as we need to accomplish a given task. The rest of our coding should be done in a language that provides a more robust set of features and tools.
After all, not all of us understand javascript as well as Monsieur Douglas Crockford
Simply this. Perhaps we should limit our use of javascript to only what you absolutely need to on your projects. Unless you're Douglas Crockford I guess ?
Unfortunately, if you're building a website with a rich and dynamic UI then you'll more than likely have no other choice. You'll have to use Javascript. Unless you use flash But such applications are rare, especially when you're building business apps like I am. Most developers will end up spending the majority of their time writing business logic, creating web services, making database calls and integrating with 3rd party apps, to name but a few things.
So it seems pertinent to write the majority of your application in a language that has a strong and robust structure (my preference being java, but even something like ruby is better than JS), and use sprinklings of JS only where you need to spruce up your application.
Unfortunately, sometimes our insatiable desire for trying new tools/languages/frameworks gets prioritised ahead of more pragmatic and maintainable options. One example is using Backbone JS as your MVC framework instead of relying on popular MVC frameworks such as Stripes, Spring MVC or ActionPack (in the case of Rails).
Comments ...