Is JavaScript a boon or a bane? Let's go to the story.
Disclaimer : I have a limited knowledge about JavaScript and so I may not be completely correct in all of my opinions.
The first time I ever heard about JavaScript was in my second year in college where I had to use it for a project I was working on. I just read some random tutorials and learnt only those which are necessary for me. After that I have hardly used JavaScript in my life until I landed in ThoughtWorks in my first project. It seems that not many people have actually read about JavaScript when they are using it. But they are just - using it.
Recently, we had an interesting seminar/discussion on this topic in my office. That was the first time it struck to me as to what is JavaScript - Is it Object Oriented or It is Functional?
Everything is an object in JavaScript. There are no classes at all - which means it is not completely OO. Even a function is an object. You can pass around functions and play football with them - which makes it a bit Functional. Well, may be it is a mixture of both - An unnamed, weird product like some substance I used to get in my chemistry lab back in my school days when I used to mix some chemicals randomly and get a black pungent deposit. It stinks!!
In the seminar, we had some very interesting examples of some of the syntactic sugars in JavaScript. I was completely agape when I saw them. What a bull shit kind of a modern day language?! I was completely pissed off by the incapability of the language to handle simple stuffs like where to put a semicolon. Because of this randomness of JavaScript, there are even no proper editors/ IDEs for it.
For Eg: What is the difference between the following?
1. return {
a = 10;
}
2. return
{
a = 10;
}
It actually turns out that the second set of statements would not give the desired result because JavaScript tries to put a semicolon at the end of a line, if it does not find one and it may end up putting a semicolon after the return statement in the second example and the function ends up returning nothing at all. What the F***??
Nonetheless, there seems to be a history behind JavaScript but the crux of the story is that JavaScript is like a premature baby taken out of a mother's womb and had not grown after that at all.
Nevertheless, JavaScript is the most popular client side scripting language. Even though there has been no improvements in the language as a whole, it is still used in almost all the websites in the world. There are some frameworks on top of JavaScript like JQuery and Prototype which actually make life a bit simpler, though.
However, it seems that there is going to be a new standard announced for JavaScript in 2011/12 which will actually make the language more strong typed and powerful and less random. Let's keep our fingers crossed and hope for the best.
Finally, according to me, JavaScript is as of now a Raavan in the guise of Ram.
wow, I didn't know the second example wouldn't work. But I suppose that could happen. I have absolutely no problem with function objects in javascript. Your eternal favourite eclipse is a good IDE for js. Finally, jquery is just too awesome. I don't know javascript, but I am good at jquery :D
ReplyDeleteThere should have been a 'like' option in Blogspot.....
ReplyDelete:-)
Catch more.... https://docs.google.com/present/edit?id=0AVOfwqEwVEB7ZGN2a2ptcnpfMTBmdzJ6dHdjZw&hl=en
ReplyDelete