If you have read the About me section of this site and the other blogs that I have written, you will know that I am passionate about family, software, economics and sports, although not necessarily in that order. So I could have written about any of these but I have chosen software. Quelle surprise!
When I was in college one of my lecturers had a twofold agenda: treating Java as God's own language and dismissing Javascript as being a toy to be used by the uninitiated masses. In fact he refused to accept that JS was a real language but considered it a scripting platform that was only slightly above a markup language. The fact that he did not know JS hardly mattered in his evaluation. He knew Java very well and I suppose that this coloured his judgement; this happens to all of us from time to time.
In this short blog, I would like to be a witness for the defense in the case against JS. It really is a case of horses for courses. Java is a full object oriented language which is ideal for large client-server solutions where it can handle all the back-end processing (it is quite weak in the front-end/user experience arena). It is a stand-alone language which can, of course, be compiled to byte code (rather than machine code). Although it has tried to 'muscle in' on JS's territory with applets, it has not had much success and, like it or not, JS has remained dominant in the web development world.
JS in contrast, is not standalone and must be embedded in a web page. It is however, extremely nimble and easy to use and compatible frameworks such as jQuery enhance its 'write less do more' image. The fact that JS is a weakly typed language can sometimes cause problems and is something I would like to see addressed, although invoking strict mode ("use strict") can somewhat alleviate the problem. However I am constantly amazed at how much can be achieved by a couple of lines of code and by the confluence of JS, jQuery and CSS. (Shopify have gone a step further with their development of Liquid which removes the need for server side code; this is possible where databases are predefined.) For instance, the simplicity and nimbleness with which one can develop responsive pages (an essential in today's world) is very impressive, although I know that this can be achieved solely by CSS. I have not used Java applets but having a knowledge of the language, I believe that it too clunky and inflexible for this purpose. In general, the amount of code that a developer has to write in JS is very little compared with Java. To me, a good language is one where a lot of the 'grunt work' is abstracted away from the developer, thereby leaving him/her free to address business requirements. I was surprised at poor Java was in this regard. In contrast, when a new feature or workaround in JS/jQuery/CSS reveals itself to me I am often pleasantly surprised at how easily it can be executedand how concise the syntax is.
Whilst there is a requirement nowadays for most web pages to be dynamic, the type of processing that is required is not nearly as heavy as that required in client server solutions where a language such as Java is necessary. Companies may start to move whole Enterprise Resource Planning (ERP) systems to the web (where only a browser is needed on the client side to access the system). When that happens, perhaps the limitations of JS will be exposed and a more industrial OO language like Java will be required. Until that day comes, I really like JS, jQuery and CSS just the way they are; lightweight and flexible with a high level of abstraction.
Perhaps, I am as guilty as my lecturer in that I am displaying a bias in favour of the language that I know the best. I am willing to listen to anyone who is expert in Java make a case on its behalf and to change my mind if such arguments make sense. As of now though, I am sticking to my position.