GWT And Now Script#: The Agony of a Thousand Puppies

By Dimitri Glazkov
Posted on 05/23/06
Uh oh. Another reactive rant. Am I turning into a grumpy old man? This time it's about layers of abstraction. And Javascript. And the meaning of life. No? Maybe not the meaning of life.

Nikhil posted about his new pet project, Script#. Although I had fun reading the article and admiring the work, I am not enthusiastic about the approach. Google had posted their GWT a bit earlier and it evokes a similar reaction from me. Here it is:

Hiding Javascript behind another language's layer of abstraction is like killing puppies.

It's one thing to build a compiler to a language that's more appropriate for machines. CLR or Assembly ain't easy to code with for any human being.

But Javascript is a fully-featured, widely used, and beautiful language. Sure, it's different from C# of Java, but it holds its own rather well. Sure, it lacks strong typing and traditional C++ form of object orientation, but that doesn't make it less versatile.

Why do I think it's a bad idea? Well, primarily because I get to experience firsthand what layers of abstraction do to code. In ASP.NET, the developers were shielded from needing to learn how Web works -- a lot of effort was put in to emulate WinForms. You click a button, and here's your OnClick handler, voila! Unfortunately, shielding developers from learning the inner workings results in some of the crappiest and undebuggable code you can imagine. Don't believe me? Check out thedailywtf.com. Or go look into the vast repositories of code, written for ASP.NET. I know, I am making a non-verifiable statement here, but hey, it's my frikin blog.

In the comments to Nikhil's article, there are sentiments to keep the Morts in the loop. One of the users is worried poor slobs won't be able to keep up with yet another language that they need to learn.

I have a very simple answer to this: if you can't handle Javascript, you shouldn't be writing code for Web applications. HTML, CSS and Javascript are the three prerequisites for this ride.

And to those of you who do know all three, please, let's stop proliferation of poorly-drawn boundaries in layers of abstraction. If you need futher motivation, just realize that you will be debugging that insanity, written without understanding how things really work.

So, where do we draw the boundaries? Well, for starters, not across the languages. I totally don't mind a Javascript 2.0 compiler that produces common Javascript 1.4. I don't mind seeing a CLR implementation of Javascript (not the JScript.NET, of course). I don't mind a powerful JS toolkit. Anything that flows along the lines of the Web style is great.

But please, pretty please, don't repeat the disasterous attempts to "simplify" the Web by allowing only one form element per page (which has to post to itself!) or requiring Javascript for the framework to react to a link click. Please? For the puppies?

Comments

  1. "Compiling" to JavaScript
    Posted by Jesse Skinner on 05/24/06
    GWT lets Java developers code Java-ish interfaces in Java and have JavaScript and HTML and CSS come out the other end. Will I ever use it? Hell no. Do I feel like my freelancing web developer business is doomed? Hell no.

    I think this is just another tool to make things easier for a niche of people who really don't care about learning a few new languages. And there are a LOT of these people. But as long as I never have to work with this stuff, we can let a few puppies die.
  2. re: GWT And Now Script#: The Agony of a Thousand Puppies
    Posted by JaViS on 05/24/06
    Escelent POST!
  3. re: GWT And Now Script#: The Agony of a Thousand Puppies
    Posted by Dmytro Lapshyn on 05/25/06
    I see your point Dimitri, but here's another point of view: business efficiency. For example, C++ is a great language, but it takes a very skilled developer to write readable and robust C++ code. Hence, nowadays, in the Windows world, its use tends to be limited to system and low-level utility programming, where there are no viable alternatives.

    The story with JavaScript is slightly different, but still similar - it is sort of pain to write [good] JavaScript code. At least this is what my past experience tells me. The browser's DOM is arcane, the events arrive in an unpredictable order, etc. etc. I am not saying that it's not possible to learn how to develop good JS code - it is, but it takes time (and possibly money). On the other hand, clean and simple C# code is much more easier to write and *maintain* - and there's a programming paradigm developers are already familiar with - async callbacks, .NET BCL for string manipulation and so on. Simply saying, this toolkit can save businesses money by reusing the existing staff's skillset.
  4. re: GWT And Now Script#: The Agony of a Thousand Puppies
    Posted by Reader on 05/26/06
    You were right, you are getting old :)

    You have to let some puppies die once in a while to fight over population
  5. re: GWT And Now Script#: The Agony of a Thousand Puppies
    Posted by Bertrand Le Roy on 06/02/06
    With all due respect, I think you're missing the point here and the whole reason why Nikhil implemented this thing: compile-time checks.
    JavaScript has no compile-time, so you're missing all the checks that happen at this time. That makes JavaScript a lot more difficult to write. Script# is not about creating an abstraction layer nobody really needs, it's a tool to write more robust JavaScript. A strong emphasis has been put on the quality of the produced code and how it looks like something you would have written manually.
    I agree it's not for everyone and it's not intended to be universally used.
  6. re: GWT And Now Script#: The Agony of a Thousand Puppies
    Posted by Dimitri Glazkov on 06/07/06
    Bertrand, due respect is all mine. And it's quite possible I am missing the point. I've missed points before. And if I don't treat this exchange as a learning experience, I am missing the biggest point of all.

    However, I look around and see lots of modern Web languages missing compile-time checks. And I am wondering: are they really needed in a language that's meant to be flexible?

    Adding the said compile-time checks effectively castrates the power of the language. All it's going to do is allow developers to write a more primitive JS code.

    I have no doubt this will be (and already is, judging from feedback) a very appealing proposition to a C# developer who doesn't want to learn Javascript. And that's what scares me.

Post your comment

  • Name:
  • E-mail:
  • Title:
  • Comment: