Teaching Java in Introductory programming courses

RebuttalJavascript is not a scripting languageI didn't think I'd have to prove this to a computer science major, but I guess Javascript biases run deep. Javascript is the biggest misnomer in computer science - it is a programming language often used as a scripting language. Like my opponent asserts, Java is first compiled to bytecode and then that bytecode is interpreted in some runtime environment (sometimes JRE, sometimes the processor natively understands it, etc). Most modern Javascript compilers however, do not interpret the code as would make it a scripting language, but rather compiles it using the JIT compilation process. This is true for instance of Chakra [1], Tamarin [2], IonMonkey [3] or V8 [4]. Precompiled binaries for most JIT Javascript compilers independant of web browsers are readily available on the net. Programming languages work by linking in to application programming interfaces (APIs) provided by some kind of host. In Java, this is the Java API. By contrast, languages like C++, C or Javascript are specifically designed to interface with any API. It so happens that the most common API for Javascript is the DOM (Document Object Model) specification, and that this is primarily used on websites. However, there is no specific reason why this need be the case. Javascript is NOT limited to webpages and doesn't require any knowlege of HTML to program even the most complex program. Like Java it can run inside a runtime (for example Adobe AIR), and it can also run compiled (see the JIT compilers above), as well as interpreted (analogous to how C++ can be interpreted as AngelScript). Any program - be it a complex application or a simple script to display "Hello World" on a website - can be written as Javascript. Proof: almost all of WebOS was written as Javascript using Spidermonkey's JIT compilation. That's why the Javascript Wikipedia entry has more than a screen full of examples of programs using Javascript outside of web pages [5]. It's far from an exhaustive list. Moreover, the popularity of Javascript outside of the web is increasing. Assembly code generated by V8 or other engines could definitely be exported, it just isn't practical compared to JIT because of the huge number of processor-specific optimisations the engines use, and because the compiling process is almost instant anyway. Nevertheless on a specific university system, where the hardware is known, V8 or SpiderMonkey could be quite easily adapted to create standalone programs with no HTML dependencies with just a few minor code changes (ie adapting the linker to use OpenGL/GLUT calls for presentation instead of DOM). Visual Studio already compiles Javascript to Windows programs via the WinJS library [6], although it does make use of HTML5 extensions for some features. Javascript is much, much easier to debugMost of the Javascript engines I cited use inline code profiling in order to improve performance. This is like compiling a program in debug mode and having it run faster as a result, which is only technically possible with JIT compilation. The result is that exceptions can be thrown in Javascript with ZERO classes, Javascript always generates automated exceptions as opposed to crashing (unless the compiler itself has an error, but this is true of Java also), and most importantly, Javascript always presents the user with detailed profiling information about what exactly their code did prior to going wrong. This allows a coder to find the cause of their error much more quickly, and they don't need to recompile their sources twice in order to test their solution. Javascript has extensive librariesThis depends, of course, on what you're trying to do. The Javascript default library has classes for managing almost every concievable type of variable, from arrays to strings to dates. This is usually directly extended by other libraries, like DOM or Node. js. Other libraries are then again built on top of that, like JQuery. JSter, a site that catalogs the "most useful" Javascript libraries, has a directory of 1055 as of the time of writing [7]. By contrast, the most exhaustive list I found for Java was on Wikipedia, which lists 85 libraries [8]. However, it is usually helpful for beginning students to understand the core fundamental concepts that go on "under the bonnet" as they write their first code as well. Javascript doesn't lock you in to using libraries for anything, and if a programmer wanted to they could technically prototype the entire standard library and write their own replacement. My CaseEasier to learn, harder to masterJavascript makes it super-simple to create a program. Given that you don't need HTML to make the alert function work, unlike my opponent's claim (it could, for example, be linked to a Win32 MessageBox interface call at the linking stage), this is even true by my opponent's admission. It's more logical too - why should you need a class for a single instruction? Classes exist primarily to contain sets of data. Javascript is, however, more OOP than Java. That's because every function is also a class, and every variable can be expressed as a function. This allows complicated OOP concepts to be explored later in their purest form - as user-defined objects. Java is far more limited in this scope. It is impossible to redefine the Java language from within Java, unlike Javascript (which allows it through prototyping), Java has basic support for objects but no closures, a crucial concept in OOP, and so on. Some of these might be somewhat advanced things that beginner programmers will not need to learn. To be honest, there are also weaknesses common to both languages - operator overloading being the big one. But in terms of the number of language features that this course, or later ones, could introduce programmers to, Javascript clearly wins out. The Javascript implementation is also closer to the C family of languages which Javascript is more usefulWhile the Java runtime environment is very widespread, it simply cannot compete with the internet. Since Javascript is the de facto standard for web scripting, Javascript compilers exist for almost every platform in common use. Given the trend towards more cloud-based systems and the trend for Javascript being increasingly used for more than just web scripting, teaching Javascript is a great springboard to prepare students for the future. Meanwhile, support for Java platforms is diminishing, with iPhone no longer supporting it and even Oracle themselves recommending disabling it a month ago due to serious security flaws. Being an open language, developed on top of an open language (ECMAscript), you can be assured that Javascript will stick around forever. However, if Oracle collapses tomorrow, then with it goes Java, since Java is absolutely useless without their proprietary JRE. Oracle has literally monopolised their own language, rather like Microsoft did with . net (anybody remember how introductory computer science courses used to teach that? ), and basically thereby pinned the success of the language on both their own success and own resolve to maintain it. I cannot honestly think of a single real-world application to which Java is the best suited language. It has all the security problems of a proprietary shell (which makes it worse than . net) and all the speed problems of being semi-interpreted. Even where it is integrated as a chip, such as in cellphones, the only real advantage over native calls is consistency of the API - something that used to be a big concern before smartphones became the norm. Javascript, by contrast, is the world's fastest and most supported language that's suitable anywhere where JIT compilation is suitable, and that's not going to be changing any time soon. Sources1- . http://is.gd...2- . http://is.gd...3- . http://is.gd...4- . http://is.gd...5- . http://is.gd...6- . http://is.gd...7- . http://jster.net...8- . http://is.gd...