The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


What's your opinion of JavaScript?

I use it and I like it
30% (227 votes)
I use it and I don't like it
37% (284 votes)
I don't use it, but I'd like to
8% (61 votes)
I don't use it, and don't want to
23% (179 votes)
Something else (please comment)
2% (12 votes)
Total votes: 763

Javascript is Good!

I can't say I am an expert in Javascript. But with use, I must say I have really grown to like the language a lot. Java is still my primary language, but I have found a few opportunities to use Javascript where I felt it made a lot of sense. For instance I needed to create a something simple to generate templates (so in essence deal with meta-templates). I ended up using Javascript on the server to do this. I know there are other ways of solving this but I had been doing some YUI and JQuery on the client side so I thought it would be interesting to see how Javascript stacks up on the server side. The best way to illustrate its power is to show some code, so here goes. //if page is found if(myRegExp.test(_requestSpec)){ var _templateDefinition = "file:///" + _root + page.@template; var template = eval("(" + read(_templateDefinition) + ")"); //load the template definition var _body = ; var stack = 0; for (var j = 0; j < page.subscription.length(); j++) { var _subscriptionId = page.subscription[j].@id; var _fragmentId = page.subscription[j].@node; //meta template method!! this is why javascript is being used. this is so simple and elegant var _subcription = template..div.(@['id'] == _subscriptionId); if(_subcription.toXMLString().length > 0){ var _contentUri = "file:///" + _root + _fragmentId; var content = eval("(" + read(_contentUri) + ")"); //load the content template..div.(@['id'] == _subscriptionId).* += content.*;//append the content to the template fragment } } _body.* = template.*; print(_body); } I can't explain how happy i was when i finished this code. Everything is succinctly parameterized. On the down side, I do get the feeling this code is not self explanatory. I haven't gotten to a place where I feel I can write maintainable code and I am sort of skirting a place where there is a danger I might not be able to understand my own code. I haven't gotten there yet but Its quite possible to get carried away and do just that with Javascript but moderately hard to do in Java.

The merits of JavaScript wouldn't be obvious to Object Oriented

ECMAScript is a very expressive and very dynamic language. Most people who don't like it, haven't cared to read the language specification. Forgive me for thinking that before you judge a language you should at least attempt to understand it as a whole. Unfortunately most people's JavaScript with web applications experience is like this. Step 1 Write Server Side Code Step 2: Realization that Server Side Code Can't Do Everything Step 3: Panic, look for -"server side" in google Step 4: Copy and paste code from dynamic drive JavaScript is how you say, way more gooders than you.

Ok Language, Shame About The Environment

I'm not a huge fan of JavaScript, but I do kind of like it. However, the most common environments for using JavaScript - browsers - are its downfall. Most people who hate JavaScript probably really just hate writing cross-browser code for IE6, IE7 and Firefox in JavaScript. Which is understandable - it's a right pain.

Ok Language, Shame About The Environment

So stop using it in that environment. I never cared much for Applets, but I love desktop Java, Java Web Start and enterprise Java. You can use JavaScript in the Windows shell. You can embed Java in your Java applications using Rhino. You don't have to use it in the browser.

Ok Language, Shame About The Environment

I would, but the web application I'm working on at my job uses JavaScript, so it's kind of unavoidable. And the main customers use IE6. (I'd choose Java Web Start if I could).

JavaScript for the front-end

JavaScript is a great language for the "last mile". In the MVC design pattern, JavaScript can be used well for the View and the Controller, while the additional performance and strictness of static typing is hugely beneficial for the Model of an application. Web 2.0, Flex (ActionScript3 aka ECMAScript 4), Google Chrome/Gears, iPhone, etc. have pretty much made it clear that JavaScript is the scripting language of choice for UI development. One of my favorite things about Java is how widely useful of a skillset it is. Virtually everyone uses Java. The same is true of JavaScript -- it is everywhere and is a very worthwhile skillset to learn. With every other new product using JavaScript as their front-end (or even core) language, it's too bad that the Java camp had to go invent JavaFX Script instead of just using a JavaScript variant like everyone else has done. -Bryan

Don't bet against Javascript!

It really fits well with Java as a scripting language; am I the only guy who scripts Java frequently? There's something truly awesome about quickly wiring together some existing components and then easily dipping back into Java whenever you want. And of course there's that whole browser thing...

Don't bet against Javascript!

I agree. It's somewhat ironic that now here, 10+ years after it's inception, it's NetScapes bastard child of a Java scripting language that is the lingo franca. While technically I prefer a static typed language, it is liberating to drop down to JavaScript sometimes. No large libraries to depend on, no slow deployment cycle etc. etc. Incremental development is really fast and for the most part, unlike Java, you get to focus on the problem at hand rather than researching libraries, IDE's, frameworks, toolkits, build tools etc.