Originally posted by: kamper
Considering how little syntactic effort is devoted to it (no namespace mechanisms, classes a bit weird) javascript has amazingly good scoping capabilities. You do have to be careful with the global scope of course.
again, you need to listen to what I'm saying: JS is problematic in a (larger) team setting. these "weird" classes, lack of namespace and global scope issues are
exactly what cause issues on a large team. just as importantly, such code is EXTREMELY tough to maintain. Wth the severe lack of effective coding, debugging and unit testing tools for JS, it is very difficult to anticipate, for example, what a minor code change affects.
so far, all the ppl replying have been on teams of just a few people, which is quite insignificant compared to the corporate setting I'm speaking of. i doubt they have felt the pain of digging through thousands of lines of JS code developed by dozens of other developers and trying to make sense of it. it's a nightmare. however, on a daily basis, I easily find my way through massive Java code bases (typically of open source projects, including GWT) without breaking a sweat.
Originally posted by: kamper
For some definition of 'proper'
how about any typing (during compile time) whatsoever? i HATE not knowing if the var I'm using contains a string or a number. The + is overloaded, so it
might be concatenation or it
might be addition. I have to use stupid tricks (such as multiplying each var by 1 or adding a "") to make sure. what a stupid waste.
again, if it's your own code you're editing, you probably know what's going on and it's not an issue. but try to maintain a large code base that others have written, and you run into difficulties really really quickly.
Originally posted by: kamper
Firebug is pretty sweet, although slowish. I haven't done java/.net development in a while but when I did, even the biggest IDEs didn't come with profilers built in. Debugging on other browsers is, of course, painful but as someone else said, that can mostly be pushed to small tweaks after you've got the bulk of the code working.
firebug is an awesome plugin. I honestly can't remember how I lived without it. it's a fantastic tool and i desperately want an equivalent for IE.
having said that, firebug absolutely pales next to the profiling and debugging tools in eclipse (and similar IDE's). integrated JUnit testing, JTest, Findbug, the debugger itself, the entire Test & Performance Tools Platform (TPTP) - not to mention the thousands of compile time checks - blow firebug and most other JS tools I've seen out of the water.
and honestly, you're being a bit too optimistic here. a great deal of a web dev's time is spent fighting with browser quirks. if you're a web dev, you know full well that just because it works in FF means NOTHING about other browsers, especially the #1 browser in the market, IE. and even if you get that sorted out, you still need to deal with all the different versions of FF and IE, Safari, Opera and so on.
Originally posted by: kamper
I'm still trying to get used to prototype inheritance and ultimately I don't think I'll like it as well as classical, but again, it's pretty impressive how much mileage javascript gets out of the simple syntax. And again, 'proper' doesn't have to mean whatever you were brought up with
i've used plenty of JS, various functional programming languages (SML), pascal, VB, Java, C++, C#, PHP, PERL and a bunch of others. i wasn't "brought up" liking one or the other, but after years of experience in working at large companies, my personal preference would be to NOT use JS for anything large scale. Again, Java is far from perfect, but it's honestly a no brainer when stacked up against JS.
Originally posted by: kamper
Examples?
obviously, syntax preference is very subjective, but i find JS much more painful to read than Java. the way objects are defined and the whole prototype structure is especially painful.
java, in part due to the fact that it is built like a legal document, is very easy to read and follow. in the hands of an even mildly competent developer, it is often fairly self documenting. i cannot say the same for JS, even with the best of developers.
and as i've been saying all along, Java also has nice IDE's that let you follow the entire path of a piece of code - with one click, see all references to the code, the type hiearchy, all implementations of an interface, and much more.
Originally posted by: kamper
As someone else also pointed out, the quirks are mostly in the api and you learn those fairly fast. Javascript 1.5 support is pretty good across the board although I'd really like to start using some of the 1.6-1.8 features with some assurance that non-firefox people can still run it. Not likely to happen
well,
javascript is not nearly as bad as
css. however, the JS link only shows event compatibility. the way you access page elements, do AJAX, find mouse position, scrollbar position and much more varies quite a bit from browser to browser.
i don't know what world you live in - maybe you only need to support 1 browser - but cross browser compatibility is a major thorn in most web developers' sides. i agree that the frameworks available for JS (protoype, moo tools, etc) have made this
significantly easier, but that just shows that by itself, JS is a massive PITA to work with.
now again, i need to reiterate that (obviously) it's not impossible to be successful with JS. there have been many successful apps built with it and as AJAX becomes more popular, JS will only grow in popularity and usage. i'm sure the language in future versions will also significantly improve - as will, hopefully, browser support - to the point where it's tolerable. but in it's current form, all else being equal, i'd pick java.