views:

708

answers:

16

Does anyone see server-side JavaScript taking off? There are a couple of implementations out there, but it all seems to be a bit of a stretch (as in, "doing it BECAUSE WE CAN" type of attitude).

I'm curious to know if anyone actually writes JavaScript for the server-side and what their experiences with it have been to date.

Also, which implementation is generally seen as the most stable?

A: 

I can't see most developers getting over their distaste for client-side JavaScript programming. I'd rather go to Java for server-side stuff before choosing JavaScript.

Cristian
+1  A: 

I've never even heard of this, but it strikes me as using the wrong tool for the job. Since programming languages are just tools designed to help us solve some problem.

Why would you want to process something in Javascript when you can process it in PHP or ASP.NET which are designed specifically for this task?

Sure you can pound a nail in with a screw driver, but a hammer works much better because it was actually designed for it...

So no, I don't see it taking off.

Adam
Why not? JavaScript isn't a "web scripting language", it's a true general-purpose programming language, that is in many ways more powerful than e.g. PHP.
Pavel Minaev
ASP.NET, on the other hand, isn't a programming language. You certainly used to be able to use JScript as the programming language for classic ASP scripts. I don't know if it is still an option for ASP.NET.
David Dorward
+1  A: 

Well, plain ol' ASP supported JavaScript server-side years ago and everyone onad their dog used VBShiate instead. But I have to agree with the others: JS does not seem to be the right tool here - and I love to do client-side JS :)

Bjoern
+1  A: 

I personally did a whole site in server side JavaScript using ASP. I found it quite enjoyable because I was able to have some good code reuse. This included:

  • validation of parameters
  • object modeling
  • object transport

Coupled with a higher-level modeling tool and code gen, I had fun with that project.

I have no numbers on perf unfortunately, since it is used only on an intranet. However, I have to assume performance is on par with VBScript backed ASP sites.

Frank Krueger
+10  A: 

I like to read Googler Steve Yegge's blog, and recently I came across this article of his where he argues that Mozilla Rhino is a good solution for server-side JS. It's a somewhat sloppy transcript, you might prefer to watch the video of the talk. It also offers a little bit of insight on why he thinks server-side JS is a good idea in the first place (or rather, why he thinks that it's a good idea to use a dynamic language to script Java). I thought the points he makes were convincing, so you might want to check it out.

A while earlier, he also posted something about dynamic languages in general (he's a big fan of them), just in case you were wondering why to use JS at all.

Hanno Fietz
+4  A: 

Why would you want to process something in Javascript when you can process it in PHP or ASP.NET which are designed specifically for this task?

Perhaps because JavaScript is a more powerful programming language than those two? For example, it has functions as first-class data types and support for closures.

Steve Yegge has blogged about porting Ruby on Rails to server-side JavaScript as an internal project within Google ("Rhino on Rails"). He did it because he likes Rails but using Ruby isn't allowed within Google.

John Topley
A: 

Server-side programming has been around for a lot longer than client side, and has lots of good solutions already.

JavaScript has survived and become popular purely because developers have very little choice in the matter - it's the only language that can interact with a DOM. Its only competition on the client side is from things like Flash and Silverlight which have a very different model.

This is also why JavaScript has received so much effort to smart it up and add modern features. If it were possible for the whole browser market to drop JavaScript and replace it with something designed properly for the task, I'm sure they would. As it stands Javascript has strange prototype-based objects, a few neat functional programming features, limited and quirky collections and very few libraries.

For small scripts it's fine, but it's a horrible language for writing large complicated systems. That things like Firefox and Gmail are (partly) written in it is a heroic accomplishment on their part, not a sign that the language is ready for real application development.

Marcus Downing
Rhino is the best of both world -- glue code in JavaScript, use Java classes which implement the rest
niXar
David Dorward
+1  A: 

It seems like most of you are put off by this idea because of how unpleasant the various client-side implementations of Javascript have been. I would check out existing solutions before passing judgment, though, because remember that no particular SS/JS solution is tied to the JS implementations currently being used in browsers. Javascript is based on ECMAScript, remember, a spec that is currently in a fairly mature state. I suspect that a SS/JS solution that supports more recent ECMA specs would be no more cumbersome than using other scripting languages for the task. Remember, Ruby wasn't written to be a "web language" originally, either.

Brian Warshaw
+1  A: 

Does anyone see Server-side Javascript taking off?

Try looking at http://www.appjet.com a startup doing hosted JavaScript applications to get a feel for what you can do. I especially like the learning process which gently nudges the user to build things with a minimal overhead ~ http://appjet.com/learn-to-program/lessons/intro

Now it might seem a weird idea at the moment to use JavaScript but think back when PC's started coming out. Every nerd I knew of was typing away at their new Trash-80's, Commodore64's, Apple ]['s typing in games or simple apps in BASIC.

Where is todays basic for the younger hacker?

It is just possible that JavaScript could do for Web based server side apps as BASIC did for the PC.

bootload
+3  A: 

Before it was acquired by Google, JotSpot used server-side JavaScript to let you query their database and display your pages. They used Rhino to do it. CouchDB uses server-side JavaScript to create views of their database.

As you can see from these examples, a great way to use JavaScript on the server is for plugins. One of the reasons it's used is that you can create a very isolated sandbox for people to run their code in. Also, because of the way that JavaScript as a language works, you can provide a user tooling specifically honed to the tasks your users need to complete. If you do this right, users don't need to learn a new language to complete their tasks, a quick glance at your API and examples is enough to get them on their way. Compare this to many of the other languages and you can see why using server-side JavaScript to provide a plugin architecture is so enticing.

A secondary popular solution, one which can be seen through a project like Jaxer, is that a common problem of web applications that do client-side validation is that, since JavaScript is easily bypassed in the browser, validation has to be run once again on the server. A system like Jaxer allows you to write some validation functionality that is reusable between both server and client.

pottedmeat
A: 

Flash Media Server is scripted by using Server Side Action Script, which is really just javascript (ECMAScript). So, I do it a lot. In fact, most of my day was dealing with SSAS.

And I hate it. Though to be fair, a bunch of that is more related to the (not so great) codebase I inherited than the actual language.

Herms
+3  A: 

Support for JS on the server has been getting stronger and the number of frameworks is getting bigger even faster.

Just recently the serversideJS group was founded. They have a lot of smart people that have been working on serverside JS for years (some of them more then 10).

The goal for this project is to create a standard library that will ultimately allow web developers to choose among any number of web frameworks and tools and run that code on the platform that makes the most sense for their application.


to the people who say "why would you choose JS over java or any other language?" - you should read this Re-Introduction by Crockford and forget about the DOM - the DOM is superugly, but that's not JS fault and JS is not the DOM.

oberhamsi
+1  A: 
  • XChat can run Javascript plugins.
  • I've some accounting software completely written in Javascript.
  • There's this interesting IO library for V8: http://tinyclouds.org/node/
  • CouchDB is a document database with 'queries' written in Javascript (TraceMonkey).

Considering this, i believe, server-side Javascript did take off.

temoto
A: 

I think server-side Javascript is guarenteed to take off. Its only a matter of time.

Mozilla, Google, and Adobe have so much vested interest for Javascript that it would take a miracle to dislodge it from the browser world. The next logical step is to move this into the server-side.

This is a step towards moving away from the hodge podge of Internet technology that usually includes all of these

  • HTML
  • CSS
  • Javascript
  • Serverside Language J2EE/ASP/Ruby/Python/PHP
  • SQL

I haven't heard much about the current state of Javascript Server frameworks, except that they are mostly incomplete.

Unknown
A: 

I see server-side js will offer considerable advantages in future applications. Why? Web apps that can go offline, client-side db store, google gears, etc...

Following this trend, more and more logic are moving into the client-side. Use an ORM that works for client-side, and use another on server-side (be it PHP / Ruby / whatever), write your synchronization logic twice in two different languages, write your business logic twice in two different languages?

How about use js on the client AND the server side and write the code once?

Convincing?

Aaron Qian
A: 

Hi there,

Personaly i've been developing and using my own JavaScript framework for about 4 years now.

The good thing about JS on serverside is that implemented in ASP Classic you don't need any other plugin or software installed, besides i'm also using my javascript (client) framework on my server, that allows me to enjoy of the same functionality and proven performance of my functions at both environments client and serverside.

Not only for data validation, but also lets say HTML or CSS dynamic constructions can be done client or serverside, at least with my framework.

So far it works fast, i have nothing to complain or regret except its great usability and scalability that i have been enjoying during this past 4 years, until the point that i'm changing my ASP Classic code to javascript code.

You can see it in pratice at http://www.laferia.com.do

Carlos J. López