Google Search

Saturday, June 11, 2011

Web Development

I recently started developing applications for the Chrome browser. This is as simple as developing any other web application, except I had no experience developing web application before.

In this post I will share my impressions of web development and finally share my ideas of next generation web development.

I had to learn JavaScript to a level that would allow me to write complex, object-oriented pieces of code. I didn't really bother with HTML5 and CSS3 - whenever I needed something I could easily find it somewhere on the web (mostly in But scripting is different. You can't just not remember the basics, so I had to learn it on the go.

My impressions of JavaScript is that it is not as good as most compiled languages (like C, C++, C# and even Java). It is not type-safe, and it's object-oriented syntax is horrifying. In addition it lacks data structures like lists and hashtables (or dictionaries), so you need to use alternatives.
By alternatives I don't mean creating your own data structures. You can achieve a mapping between a key to a value using an Object: add a member and give it the value. JSON is all about that... Except JSON comes to represent an object, not a list.

And there is no such thing as a Class. There are only Functions. You want some function to behave as a class? Add sub-functions. You want to be able to override functions in an inherited "class"? Add prototype-level function.

It's not that you can't get used to it. Well actually you can't, but still you write it automatically after a while. What I want to say is that there are so many options to write object oriented code even in scripted languages (see Ruby, for instance) that the way JavaScript is designed is simple horrible (especially with a name that suggests some relation to Java)

Everybody's talking about web development as the next thing. All big software companies push HTML5, CSS3 and JavaScript, each company with its own unique reasons. Microsoft even said writing applets and gadgets to Windows 8 would be in JavaScript (they said that it is much lighter. I don't see how ANY script can be lighter than a compiled code).

I understand the hype. I also starting to realize that web applications is the way to go for most of everyday's uses. But why JavaScript? or any other type-unsafe script for that matter? There are many applications written in Flash. While this is an improvement for the user who downloads compiled code, Flash was originally designed for web vector animation clips, so writing applications in it is really abusing it. Could be done much easier with, say, Silverlight (and C# is a much saner choice over ActionScript, which, AFAIK, is very similar to JavaScript).

Why wouldn't new browsers support precompiled code that can access DOM elements? suppose I could write in C# some code that interacts with elements in a webpage, compile it to a DLL, and link to that DLL from an HTML file. Don't worry about security issues now, those can be taken care of in a variety of ways. Think of the result - faster download times, you don't get it as plain, readable text (I know most scripts are scrambled and their variables are shortened so it's not really readable, and I know you can easily decompile a .Net DLL into readable text), and the most important thing - the browser doesn't need to compile the script on the fly. It is ready to go!

Thinking about it some more - there should be a way to compile an entire webpage. But for now perhaps the best way it to compact it (along with its resources) in a zip file (much like new document formats are doing today).

To sum things up - from a developer point of view, moving to web applications is welcome, but browsers need to support nicer scripts, and perhaps even precompiled DLLs that can access DOM elements.


  1. There is a drawback to compiled languages, and it is that you need to compile.

    The very simple edit & test cycle allows very fast and simple development cycle.

    However, I must agree with you about languages with horrible syntax. I don't see why people like Javascript and how it became so popular. There are much better scripting languages that can be used for the web. Python is an example of a very readable and object-oriented dynamically typed language.

  2. There's no point in JavaScript being type-safe except for performance, as there is no compile-time. Chrome has mostly solved the performance issue with the V8 engine. To write highly optimized JavaScript in a type-safe environment, use GWT (write your code in Java, it compiles to optimized JavaScript). JavaScript is the new machine-code for the client-side web. That's why it needs to be light, and doesn't need classes nor compile-time type safety.

    Your suggestion is called either ActiveX or Java Applets, they both failed for a reason. GMail is written in GWT (so the client side is written in JavaScript), and this performes much better than ActiveX or Java would.

    (Also, JavaScript is only called that due to politics. The original name was ECMAScript, and the language has no relation to Java other than the fact that you can use it to control Java applets).

  3. Ohad,
    Thank you for your reply and for informing me about GWT and the original name of JavaScript.

    However, my suggestion was not something like ActiveX or Java Applets at all. I didn't mean to include a visual object in the webpage. I did mean to include a cross-platform pre-compiled library (such as a .Net DLL or a Java .class filee) to run in the background and access the DOM, the same way JavaScript is doing today.

  4. Outsourcing to Eastern Europe has a range of advantages due to its attractive cost-to-quality ratio. I would recommend checking out this article to learn more about the software development in Eastern Europe .