Teaching Java in Introductory programming courses

1) Java is more useful and easier to master Con compares the Java Runtime Environment My opponent mentions the cross platform benefits of Javascript. However, Java was designed by Sun to work on multiple platforms making it possible to develop Java applications over the internet [4]. Oracle has also released to security updates to fix flaws [5]. The flaw my opponent is referring to has long since been fixed. It is like saying that Windows 7 should not be learned by children because Windows Vista was flawed. The only difference in my analogy was that Oracle didn't rename the fixed version of Java. Oracle also changed the default security setting for Java from "medium to "high" alleviating concerns over security issues [5]. Con says that if Oracle collapses tomorrow, Java will go with it. This is an unsupported assumption. There is no reason to believe that Con's scenario will hold true as opposed to Oracle selling the JRE to another business or making the JRE open source before going under. In any case, Oracle's value has been increasing over the last 1 year, 5 years, and 10 years consistently [6] so this is a far fetched scenario. Java is also about 200 times faster than Javascript [7]. My opponent also metions some Javascript features which are very advanced. This is non-topical to the resolution as we are talking about an introductory course. While he claims that Javascript is easier to learn and harder to master, he provides no reason why this is supposedly a good thing. While Java may have a steeper learning curve in the first couple of weeks, by the end of a course, Java students feel a sense of fulfillment from having mastered the language as opposed to Javascript students who have done the easy stuff but there is much more complex stuff that they don't understand. 2) Downfalls of JavascriptMy opponent says that Javascript is not a scripting language. I never called it a scripting language although wikipedia does. Let's examine this definition of Javascript from wikipedia. "Javascript is a prototype based scripting language that is dynamic, weakly typed and has first class functions."[10] Every adjective to Javascript provided shows why it is a terrible choice to teach in introductory classes. It is dynamically typed, meaning it executes at runtime what many other programming language would perform at compile time. These behaviors include extension of the program by adding new code, by extending objects and definitions, and by modifying the type system among other things [9]. Doing this at runtime makes it more difficult to find errors. Statically typed languages allow the programmer to catch the majority of their errors at complile-time by reading the compiler messages and correct their code before runtime. Correct faulty code at runtime makes little sense because the programmer doesn't know whether there is an error before running the program which gives programmers a false sense of security. Runtime errors in dynamically typed languages are more difficult to locate because many test cases need to be tested before the program is guaranteed to be running fine whereas with compile time errors, the compiler does the job for the programmer. Javascript is weakly typed. This has many disadvantages. Weakly typed languages catch fewer errors at compile time and some might even remain after testing has been completed [12]. While it is possible for a weakly typed language to be type-safe, it is much more rarer than in strongly typed static languages because there is no implicit conversion between types. While this may sometimes be onerous for programmers in Java, doing so discourages lazy habits and ensures that what you declared as an int in the beginning of the program doesn't suddenly end up as a string at runtime while you are completely oblivious to the fact. Javascript has first class functions. This means that Javascript supports passing functions as arguments to other functions. This creates many implementation difficulties whjch are collectively known as funarg problems [11]. Java works around this by requiring that the context used by context used by nested functions in anonymous inner classes be declared final. 3) Unique features of Java Standard library:Con claims that Javascript has a large number of libraries. Most of these are non-standard and require additional time and effort to learn. A course on Javascript can hardly spend hours teaching jQuery and other libraries that add a layer of complexity onto Javascript. Java's standard library has hundreds of classes and multiple methods within each class as shown in this page from Oracle [13]. Every method also lists the parameters it takes so it is a simple matter of plugging in the required parameters to get the required result. Dynamic Binding and Polymorphism: Polymorphism in Javascript doesn't work the same way as it does in Java. In Javascript, if you have two functions with the same name, the most recently defined function will always get called and there is no choice offered unless the programmer makes specialized functions just to support multiple possibilities [8]. In Java, the method that gets called depends on the number of parameters being passed so the programmer can choose to invoke a specific method by passing in the right parameters. Furthermore, suppose you want a subclass to have a method with the same name as a method in its superclass, but behave differently from the method in the superclass, you can override the method in the superclass with the method in the subclass. So, when an instance of the superclass calls the method, the superclass's method is called and when an instance of the subclass calls the method, the subclass's method is called. The meaning of the method depends on the type of object that invokes it. Note to readers: A "function" in Javascript and a "method" in Java are the same thing. Classes and Objects:Con says that classes are needed to contain sets of data and asks why you need a class for a single insturction. The answer lies in the fundamentals of Object Oriented Programming. True OOP uses procedural abstraction. Creating a class and keeping its implementation mostly private creates a requirement for code outside the class to be able to function without knowing the inner details of the class and how the class provides the results that it does. The code outside the class must only know what to provide to the class and what the class gives back. If code outside the class requires any knowledge of the inner workings of the class to work, then the class is no longer a separate module and its implementation cannot be edited or changed without also affecting programs that rely on that class. Hence, Java is organized in a way where everything is contained within classes. Non-OOP programming languages lack this feature making them inferior to Java. While Javascript is an object oriented language as well, I have shown in my previous round how you can write Javascript code outside of a class in what would in Java be a violation of an Abstract Data type wall. Sources [4] http://www.computerweekly.com...[5] http://allthingsd.com...[6] https://www.google.com...[7] http://cycling74.com...[8] http://javascript.about.com...[9] http://en.wikipedia.org...[10] http://en.wikipedia.org...[11] http://en.wikipedia.org...[12] http://en.wikipedia.org...[13] http://docs.oracle.com...