# Saturday, 05 April 2014

I was recently pointed to the article "10 Very Good Reason To Stop Using Javascript" It sure sounds like link bait to me, but I do think about some of the things so why not? Here's goes a reponse to each of their reasons

1. Javascript Hurts Your Mobile Visitors

This is quite true I suppose, I always have this nagging worry about the whole Single Page Application (SPA) website design which everyone seems to use to be cool. My worry is that a web browser's Javascript virtual machine isn't meant to be running for extended periods, and staying on the same page constantly manipulating elements would just drive it insane. A good example is of course.. the Facebook website, leave it open long enough and depending on your feed you should see your web browser start eating up a ton of resources.

But then again, some of this is just probably caused by bad code and design, so when done right, this is obviously not an issue. After all, if someone had to write 10,000 lines of Javascript to get a page to work, it might mean that he would need 10,000 lines of HTML to get a page to work without Javascript, so where would we be at then?

2. Javascript Hurts Your Robustness

This is true... but then again, this is true for any sort of developement platform if you use a third party library! If we only talk about it from the Javascript angle, the way I try to minimize the impact on my projects is that I prefer Javascript libraries that only have a single role such as to provide UI enhancements such as Bootstrap and avoid entire frameworks that might end up dictating the system design on the server side as well such as AngularJS

3. Javascript Hurts Your Security

The article mentions about security issues like XSS and XSRF, and yes these are legitimate issues. But again, it's a developer problem, like SQL Injection before it, it's a common issue that developers have to actively make sure they're doing their jobs properly to minimize security problems (The reason I didn't say ELIMINATE is that there's no such thing as perfect security... although most security consultants would of course tell you otherwise)

4. Javascript Hurts Your SEO

ABSOLUTELY true, ESPECIALLY true if you're implementing your site as a Single Page Application (SPA) Google has some guidelines on making your AJAX links indexable but that probably only works with Google. Surprisingly the solution I used which was to create an invisible link to a dummy non AJAX static page with listing of links worked pretty well, I later found out that this was an actual method which people have talked about called a snapshot.

5. Javascript Hurts Your Development Time

No shit, but then again it's the same as with any development language which a person is unfamiliar with. But while it's true that Javascript code can get VERY complicated and messy (ESPECIALLY true if you're using MVC libraries) Tools are getting better, developers are getting more experienced.

As for cross browser / cross platform compatibility and testing, my approach to it is that if the web application NEEDS to be pretty much powered by Javascript with no fallback possible, I'll inform the client that only HTML5 level browsers are supported, and that means IE < 8 is totally unsupported, IE < 10 will see some visual discrepancies, but major functions will work. You might argue that there are ways to get everything to work and look exactly the same but in that case you're just setting yourself up to be hit by this issue as well as the issue #2.

6. Javascript Hurts Your Testing Costs

Again, this is very true. From my experience this seems to be mainly caused by the fact that traditional testing systems are unable to test Javascript heavy sites because they are unable to execute the Javascript in the context of a webpage. So it gets very complicated and expensive to bring in the resources necessary to test the system.

7. Javascript Hurts Your Website Performance

Aaaa.. the TIMELESS battle between the developer and the client arguing that the page must finish loading before X seconds or MILLIONS of users will be lost!!! You don't need Javascript to cause this issue, but of course, again it's all up to the developer to do a proper job to deliver better performance. And it's up to the Project Manager to tell the client that their expectations of a page just APPEARING in the browser is not physically possible.

8. Javascript Hurts Your Software Investment

"Client-side technology is doomed to fail" Wow... that sounds exactly like how people use to argue that ThinPCs would become a thing and normal x86 desktops would fade into obscurity. Let's break down the original article's examples.

Java applets failed primarily because the additional cost of the runtime download made it a barrier to entry for normal users BEFORE the broadband age, although once we DID have the bandwidth Oracle didn't seem to be interested in paying much attention to the applet usage of Java anymore. It also didn't help Java's case that a HTML5 browser's capability has caught up to MOST usage scenarios for a Java applet.

During it's time Flash had a smaller runtime download and could deliver impressive multimedia capabilities and features when compared to Java, that's what made it the dominant plugin previously. There's a chicken and egg argument about the role Apple played in Flash's demise when they choose to chase the HTML5 standard instead of Flash, but without a doubt HTML5 once again had most of the important features which someone would use Flash for but WITHOUT the additional runtime download.

There's only one thing that Flash is currently still ahead compared to HTML5, and that is it's ability to manipulate and playback video files. Due in part to everyone still trying to figure out how to standardize video manipulation based on patented video codecs I believe.

The main risk for Javascript boils down to WHICH library or framework do you bank your future on? Because you don't want to back a library where the developers decide to abandon it after a few releases and stop patching bugs... But again, this is an issue that isn't exclusive to Javascript only.

9. Javascript Hurts Your Software Architecture

This is true, write Javascript long enough and you'll know that it's incredibly messy to get any sense of order once your application reaches any sort of scale. A lot of people are trying to solve this issue by coming out with new languages like Typescript and DartScript. But those feel more like band aids to me. I try to avoid hitting this issue by avoiding the SPA metaphor (Because this is the simplest reason to cause your application to scale) and I will never use any sort of Javascript library that exerts influence into the backend server design.

10. JavaScript Is Not Needed

Absolutely FALSE!!! While it is true that almost anything you can do with Javascript can be done on the server side (The author of the original article seems to be ignoring any sort of UX requirements and filing them under "new" and "cool") Proper used of JavaScript allows many performance gains and UX improvements.

The NEED for Javascript should never be questioned. The question is that can the developer be entrusted with the power of Javascript responsibly?

I like to mention that if there ever was a language worthy of the phrase "With great power comes great responsbility" It would be Javascript.

And that's it... damn.. this rant is longer than the original article, well, hope it helps to provide some insight to this topic!

Note that you can Post As GUEST as well.
blog comments powered by Disqus
Comments are closed.