Server Side JavaScript
Blog Wednesday, January 19 2011I’m going to warn you that this is a rant. I just can’t take it anymore. Microsoft is a great company but there are some things going on at Microsoft these days that are very, very unsettling, in my opinion. I am going to address one of those issues in as graceful and as courteous a manner as I can muster. At a minimum, I promise not to go all Bellware on them. Here it is.
JavaScript is arguably the most popular programming language on planet Earth. I’m not sure what the Alpha Centaurians code in but it probably looks a lot like JavaScript, too. JavaScript isn’t perfect but it’s deliciously dynamic and declarative and just as functional as most people really desire in a general purpose programming language. I totally appreciate the great things that Microsoft is doing on the client side to make JavaScript faster, more standards (meaning jQuery) compliant and to provide better tooling. But don’t we deserve the power and flexibility of JavaScript on the server side, too?
Back in the day, I coded using Server Side JavaScript (SSJS) on Netscape Web Servers running on Solaris. It wasn’t that great an experience as I recall. It was OK but the development tool support was pretty weak and the debugging story was just awful. But JavaScript has matured a lot over the past 15 years since control was handed over to ECMA. Development environment support for JavaScript is very good now, even from Microsoft which seemed to be doing everything possible to make the JavaScript experience for developers and end-users poor until a few years ago. After so much noise, I suppose they couldn't ignore us any longer. And it’s a good thing, too. Without a fast, highly-compliant scripting language in Internet Explorer 9, that browser version would be doomed to be Microsoft’s last, in my opinion. Microsoft really does get it now about JavaScript in the browser. Hiring someone like Rey Bango is a testament to their understanding. Microsoft simply must have an excellent JavaScript story to tell with IE9. It’s got to pass all the benchmarks and compatibility tests with the highest possible marks. And the Visual Studio integration has to be tight, especially with respect to debugging. I have no doubt that Microsoft will do everything that they need to do to make JavaScript a first-class citizen within Internet Explorer from now on.
Microsoft’s JavaScript story on the server side isn’t all that rosy, however. In fact, other than a nascent, very limited version that showed up in some DLR alpha bits, there is no SSJS story from Microsoft. My repeated attempts to get Microsoft programming language product managers to engage in meaningful conversation about SSJS have fallen on deaf ears. They usually just stare at me when I say that we really need a good SSJS story as if I’m speaking Alpha Centaurian. They usually nod and say something like, “Yeah, well that’s nice but um… I need to go. My little brother got his arm stuck in the microwave so my mom had to take him to the hospital… And my grandmother freaked out and hijacked a busload of penguins. So, it’s kind of a family crisis. Buh-bye.”
Unfortunately, this is pretty much in line with the dynamic language story that we’re seeing from Microsoft across the board. The IronPython implementation got just up to the point of near perfection and BOOM! They dropped it. I think it’s somewhat noble of Microsoft to turn support of IronPython and IronRuby over to the community as they did. They didn’t just abandon it. But let’s be honest. You don’t give control away to the community if you’re invested. The community will do good things with both of the Iron languages but some problems require a company at Microsoft’s scale to get the mindshare they need to succeed. Microsoft’s decision to give up (for all intents and purposes) on IronPython and IronRuby is just a bad business decision, in my opinion, no matter what other irons (pardon the pun) Microsoft has in the fire. I know that Microsoft has other priorities but they made a huge mistake within the developer community with those decisions.
When I first met Harry Pierson of Microsoft a few years ago, his enthusiasm for the Python language rubbed off on me. I already loved Python from having worked around the RocketMail guys many years before when I was at Intel (before the Yahoo! acquisition of RocketMail). I could tell after swapping ideas about IronPython and the DLR around for a few hours that Harry and I were kindred spirits. Harry’s love for the Python language is totally infectious. I’ve always had a penchant for dynamic languages and Python, in particular, really rung my bell, so to speak. Python’s syntax is so light and clean and fluent. There’s little or no ceremony required to get truly wonderful work done with a few lines of code. And the standard library is very rich: “Batteries Included” we say in the Python world. Best of all, Python has excellent support for my other language love affair: functional programming. So much so that when I started working with the F# language, it felt Pythonic to me. It’s no wonder that a couple of years later, Luke Hoban (from Microsoft’s F# team) revealed to me that the F# programming language was deliberately designed to attract Python developers. From a statically-typed versus dynamically-typed perspective, these two languages couldn’t be more in opposition to one another. But the feel of working in F# is authentically Pythonic. And according to Luke, that feeling was embedded there quite deliberately.
Recently, I’ve been thinking about the state of things in the language world. My one biggest regret is failing to tell Microsoft how important dynamic languages are to me. I blogged about IronPython a lot. I gave dozens of user group and Code Camp presentations on integrating static and dynamic languages using .NET technologies. I even have a book coming out this year called Metaprogramming in .NET from Manning that contains a hundred plus pages on the Dynamic Language Runtime and all the great metaprogramming things that can be done with it. The DLR is firmly in place in the .NET Framework so I’m not worried about that. But seeing what’s happened to IronPython and IronRuby over the past few months, I lay awake at night sometimes wondering what else I could have done to make influential fellows like Scott Guthrie and Scott Hanselman and Somasegar understand why they should be showing their support publicly and within Microsoft for dynamic languages. I honestly feel like I failed my developer colleagues by not being a better spokesperson for Python and Ruby on .NET. Moreover, my grief about the subject spills over into other languages that should have been. Those that could have been. Server Side JavaScript is chief among them.
My reasons for wanting Server Side JavaScript running on the DLR are pretty simple. Today, I write in a multitude of “languages”: C#, F#, T-SQL, PL/SQL, JavaScript, CSS, XHTML, XSLT and a handful of other XML dialects that come in handy on occasion. It’s all too much really. As I use each of these “tools”, I ponder why they fit well for solving particular problems. Each of these languages is appropriately domain-specific which then leads me to wonder why I work in so many domains. Setting that question aside for a moment, I can’t help but think that if all the genius floating about in Microsoft’s Building 41 were aimed at creating a world-class Server Side JavaScript implementation on the DLR, we could rest our heads on our pillows at night enjoying a common language between at least two of our important domains.
I imagine a world where I might write JavaScript to render an MVC application, for example. The tooling in the environment I envision is so tight that emitting JavaScript to run on either side of the “pipe” is simply a matter of choosing the correct namespace. Better still, the JavaScript I’m thinking of has a runtime engine that decides where the code should execute. On a slower connection, the engine might decide to remote some of the code to the client side to provide a better user experience. On faster connections, it might decide to generate more AJAX callbacks from the client and run more of the code on the server to speed up the application or to enhance security. Emitting minified or pre-compiled versions of types and functions in my library would also be totally invisible to me. It would be automatic. Intrinsic. Creating markup from this system would be completely integrated, too. Calling an application a web app or a desktop client would be a thing of the past. There would only be apps. Making mental distinctions about where or how code must run would seem totally foreign to developers in this environment. Code in this dream becomes pure intent: homogenized, universal and sufficiently abstracted from any implementation constraints to become properly focused on solving problems first and foremost. List comprehension and query comprehension would eventually give way to a fully declarative intent realization model, arguably the goal of any universal computer. I did say this was a dream, didn’t I?
I know it may sound crazy. Some of the things I envision probably won’t be achieved in my lifetime. But think for a moment about the kinds of innovations that would come out of the process if the languages team at Microsoft utterly embraced JavaScript on the server side. Think about the developer experience they would craft in Visual Studio. It would be no less than stunning. Think about the editor and debugger and designer experiences. Imagine how IIS would evolve to support such a unified JavaScript execution model. Ponder for a moment how the JavaScript language itself might evolve if Microsoft put all of their mental and marketplace muscle behind it as both a server and client language of choice. Over time, languages like Python and Ruby would actually suffer from that kind of dedication as developers flocked to JavaScript as the common language on both sides of the average Internet connection. Silverlight, as much as I admire it for what it needs to be in 2011, would simply evaporate if my vision were to become real. And in that sort of scenario, Silverlight’s retirement wouldn’t be seen as a bad thing at all. Rather, it would just be a natural part of the evolution toward a better, more unified web for everyone.
Justin Etheredge turned me onto node.js at CodeMash 2011. It does evented I/O on Google’s V8 JavaScript Engine. Extremely cool stuff for building web services and definitely a step in the right direction, in my opinion. Google is a great company but I wish it were my trusted friend and partner Microsoft taking this step with me. Say what you will about Microsoft but my corporate and government clients trust them. And that’s why I’ve invested so much of my career in making Microsoft technologies successful. If I have to start migrating toward other vendors, I will do so. But I lament that decision in my heart of hearts. I can only hope that some of you who read this will agree with me and echo my sentiments in your own way.


1.31.2011 at 9:02 AM
I read your dilemma as "my clients trust Microsoft (almost exclusively); therefore I want Microsoft offerings to be the best". This argument seems about face to me. My personal solution is to use whatever solution is the best for the problem, using whatever technologies are best, and have examples of rock solid websites using your choice of technology if clients need convincing (I'll bet your clients have no issues with the performance of Gmail or Google search for example, if google-built tech is in question?). Certainly I have no interest in helping support an MS monopoly by avoiding trying anything other than what MS provides - if MS did V8 you could be sure it'd only run on windows.
Also note that there is no "vendor" with node.js - its all FOSS that can be downloaded/modified for free, and Google aren't even the ones pushing node.js!
Also I can't seem to post a comment from any browser (even IE) - I had to cook the javscript by hand in Chrome. Google make awesome dev tools ;)
1.31.2011 at 1:32 PM
I agree Tom but it's about momentum verus inertia. My clients have deep relationships with Microsoft products, training and support. They often don't want to change (hence the related inertia) for fear of weakening that relationship. So I need Microsoft's tools to be excellent and in most cases they are. Visual Studio and most of the .NET framework make the development experience very satifsying. But the lack of real dynamic language support on the server side, esp. SSJS is becoming a real problem for me. Microsoft is making their loyal developers look elsewhere by not finishing what they started. The DLR now needs a world-class JavaScript solution built on it. A Rails-like web platform running on SSJS would soon follow from Microsoft or better yet from the developer community. And yes, the Google Chrome developer tools are the bomb. I found and fixed the problem with posting comments using those tools. :)
1.31.2011 at 1:48 PM
I've been singing this same tune to everyone at Microsoft that will listen. I think it's critically important to the future of the platform. Once node.js matures a bit more and people begin realizing that they can write their entire app in one language, selling them on separate server-side and client-side languages is going to be tough. For that matter, why would a new developer even bother learning both JavaScript *and* C#, PHP, Python, or Ruby if JavaScript alone is all they need?
As much as I do like the direction C# has evolved, I think SSJS has the potential to really blindside the ASP.NET platform as a whole if they don't get out in front of it.
1.31.2011 at 4:07 PM
Hey Dave, I think ASP.NET has already lost, to a certain extent. They started MVC too late, really. But it doesn't mean that Microsoft can't recover. They just need something very Rails/Drupal/Django-like in the space to remove so much of the complexity in web development. Personally if I could write in JavaScript on both ends of my web connections, that would represent a big drop in complexity. This is essentially what Silverlight aims to do. But standards-based development is going to win in the long term. And that means using JavaScript as the lingua franca, IMO. I love C# but I'd love JavaScript just as much, probably more, if I could speak it everywhere.
1.31.2011 at 4:35 PM
I'm a big dynamic language guy, but I do enjoy C# coding quite a bit. I'm with you that JavaScript on the server side can't be ignored. JavaScript is really important these days for a snazzy web app. Having the same language on the server side would certainly be a great convenience and open up options like you suggest easily.
What I'm not with is are you saying you can't use anything that isn't Microsoft? Or does it just have to be on .NET? So IronJS would be great if the community ever got behind it? It's unfortunate that some clients will specify technology before they even consider the requirements.
This leads me into complaint. So many of .NET developers I run into seem to be completely ignorant of anything that doesn't get a marketed release from Microsoft. Seriously unless you just have to use .NET and Microsoft do yourself a favor and start experimenting with technology and evaluation them for their strengths. Don't just hit up a random .NET blog post for "the one true way" every time you need to do something. Of course what's the incentive if they have to use MS?
Oh, and why do so few developers in the .NET space take dynamic languages seriously? Is it because MS never got seriously behind them (well not for a very long time)?
1.31.2011 at 4:43 PM
What does it mean to "go all Bellware on them"?
Does it mean to organize one of the first and arguably one of the most notable .NET developer communities.
Does it mean to chair the INETA Speaker Committee and to get the first Agile and interop speakers onto the roster?
Does it mean to volunteer time to teach Agile and TDD at user groups in the US and Canada during a time when Microsoft was openly-hostile to these subjects?
Does it mean to work with Microsoft in their early forays into ORM?
Does it mean to work for a number of years to get progressive content into mainstream conferences like DevTeach?
Does it mean to organize community engagements with the Entity Framework team and to orchestrate events so that more of these would happen during pre-release?
Does it mean volunteering time to Microsoft to teach TDD on campus in Redmond to Microsoft product developers?
Or does it mean to hold Microsoft to account when it deserves to be held to account as you are doing here?
1.31.2011 at 6:40 PM
Maybe I am not quite getting what your getting at but, I believe this is what Microsoft is trying to achieve with ASP MVC. Tons of server side support and if you want to do server-side javascript no problem there are already classes in MVC2 and 3 that enable that out of the box.
1.31.2011 at 6:43 PM
+1 on Scott defending himself
Good post on why aren't the Gu and Hanselman promoting Iron*
It really makes no sense because Iron* means we still run on code on MS cashcow (server OS licensing and now cloud )
MS shifted everything to Silverlight and now IE9 but it will take 10+ years to get everyone off IE 6,7,8
2.01.2011 at 2:44 AM
I use Javascript on the client side for one reason only, there are no alternatives. If I could us another language I would. Javascript is, in its current incarnation, an abomination foisted upon the world against all reason, and has in and of it self set client-side development back by decades.
Javascript as a server-side language is as welcome as cancer.
Your request should not be Javascript on the server but Ruby, Python, Java (possible with applets), C# (can do that now in SL), Actionscript (fine in Flash) or any other language on the client. Yes, I would love to use the same language on the server and the client, and for intranet projects I do so already with C# and Silverlight. A single developer with .Net MVC and SL is an order of magnitude more productive than someone using, for example, Java on the server side and Javascript on the client.
Sadly Sun badly messed up Java on the client, it would have been the logical solution. It also seems like Oracle and the messy "standardization" process is going to at least maim Java on the server.
Currently there are no good alternatives for your request, but Javascript on both sides is probably the least attractive. We should instead work to get it banished from the client and replaced with something that actually works and makes us productive.
2.01.2011 at 11:50 AM
I don't understand all the JavaScript hating. Certainly the inconsistency between browser DOM APIs suck, but frameworks these days have helped considerably with that.
As a language I think it's awesome. A beautiful blend of functional programing and objects. Has some warts but so does Ruby, and I don't see Ruby running in all major browsers anytime soon.
@Chase - I'm not sure what you are talking about.
2.01.2011 at 3:43 PM
I agree with you wholeheartedly. Killing IronRuby and IronPython are shocking decisions from Microsoft which reduce the viability of the .Net platform in the long run. They are literally pushing developers away from their platform.
Microsoft, if you're reading this, don't shoot yourself in the foot by abandoning IronRuby and IronPython and underestimating the need for a node.js equivalent in .Net.
2.01.2011 at 4:58 PM
@Copenhas - the resistance that many MS developers display to looking outside of the MS sphere is very much related to how they manage their sales and support channels. Lots of companies won't even consider competing technologies if they believe it will affect their volume discounts. I work with really large companies and the impact is often measured in dozens of millions of US dollars every year to the company's bottom line. When the decision to go all-one-vendor has been made, the developers have to work within those parameters. And I agree that JavaScript is pretty awesome as a language. It's got problems, too, but it's also incredibly expressive and versatile.
2.01.2011 at 5:39 PM
@Scott Bellware - I meant Thelonius Bellware. I hear he's a really nice guy in person but his online persona leaves something to be desired. Oh, and he's "half the community leader" you are, too. Sound familiar?
2.01.2011 at 5:44 PM
@Terje - yeah, Sun messed up a lot of things. Pretty much everything, if you ask me. I'd be a hardcore Java bigot today (probably) if Sun had done at least one or two things correctly. Selling to Oracle was just perfect in that vein of failures. IBM would have been an excellent steward of the Java language but Oracle will do nothing but make it worse, IMO. JavaScript on the other hand is quite beautiful. I'm surprised that you dislike it so much. But to each his own, right? Great comments. Thanks!