views:

335

answers:

12

I have always thought of JavaScript as a client-side scripting tool for augmenting the functionality of HTML, which in turn is usually generated by some other server-side technology - Java, .NET, Rails, Django, PHP, etc.

Recently though I have heard people talk about JavaScript as an "application language". I understand that applications like Gmail have taken JavaScript to the next stage of evolution and have made the browser much more like a full-featured application. But as far as I know, there are no server-side technologies like the ones I mentioned earlier that are JavaScript based. So even in the case of a Rich Internet Application, the "application language" is really the one on the backend that interacts with the database and performs URL routing, etc.

Is my understanding outdated and is JavaScript now capable of performing backend processing or are we willing to call it an "application language" simply because its current sophistication in what it can perform on the front-end is such that the backend processing has become secondary?

A: 

See Jaxer

With Jaxer, your JavaScript gains full access to databases such as MySQL or the integrated SQLite database. Rich filesystem I/O as well as low-level network socket access are available to you all directly in JavaScript on the server. And you can call those server functions seamlessly from the client - exposing only the ones consistent with your security requirements.

redsquare
+4  A: 

I disagree. With the advent of web services you can write your entire application client side if you want and simply interact with web services via AJAX. I wouldn't recommend this, but it could be done. Now you might consider the web service as part of the application, but I think the point could be argued that it's no more part of the application than your database technology.

tvanfosson
+1  A: 

Microsoft's JScript engine can be hosted in a wide range of applications. It can also be used from several other standard general purpose script hosts such as WSH and MSHTA in addition to IE. It can be hosted server-side using Classic ASP as well.

This means there are several ways to create non-Web applications using JScript under Windows in addition to server-side Web applications. This includes stand alone or client-server desktop applications.

Similar tools exist from other sources. Most of these support additional platforms beyond Windows.

Bob Riemersma
+5  A: 

Serverside Javascript has been possible for a long time now. I maintain coded with it every day. It's way better than classic ASP (at least I can have "real" objects, and try-catch, etc).

Another great thing is that you can avoid recoding your forms validation code in different languages. I just use a javascript file like this:

<!--//<%
//code
//%>-->

That allows you to both include code with <!--#include file='name'--> and with <script src='name' />. On the downside, it could be lot easier to "break" your validation code by looking at it (if you weren't careful enough). Never put sensitive information in there outside the validation code. Also, you can choose the file extension that you want, but never save serverside javascript that does database access as .js. .asp files are by default executed and not send as plain text. That is not true for .js files, which are only executed if they are included in an .asp file.

voyager
And Try-Catch blocks.
Spencer Ruport
You are right. Adding it right now. `javascript`'s advantages over `VBScript` are too many to even *start* here.
voyager
+1  A: 

See Rhino for a javascript implementation written entirely in java. It is typically embedded in a java program to enable scripting, so it can be used server-side.

quamrana
+2  A: 

JavaScript is a language that is turing complete, is relatively widely adopted and understood in its syntax and structure, and has out of browser runtimes. It's been used in server side scripting, command line scripting, and for developing robust web applications since its inception. It's also the exclusive language on the Palm Pre, running WebOS.

What has hurt JavaScript in gaining wider recognition as a "full fledged" prime time serious language has been its lack of uniformity in implementation. Honestly this has largely been because of Microsoft's attempt to institute proprietary extensions and it's misguided attempt at divisive technologies such as ActiveX, JScript, etc.

With a complete object model and relatively sophisticated set of libraries behind it now, there's no reason to not regard it as seriously as any other modern language in wide spread use. Indeed, it's probably the most widely known computer language today.

groundhog
A: 

I've written several in-house tools in JavaScript. The advantage is that it's easy to throw together some CSS and HTML to get an interface for things I would normally have done as just console commands.

Nosredna
A: 

You may want to do some research on widgets. Web Widgets are small programs that are created using web languages (HTML, CSS, Javascript) and have some specific small function.

Opera is currently using them, you see them on Palm's WebOS, and there is a W3C specification coming out soon for them.

W3C Widget 1.0

Opera Widgets

Doldrim
A: 

You can create desktop applications with Titanium Desktop using web technologies, including JavaScript, or Python and Ruby if you wish.

Sam Hasler
+1  A: 

CouchDB makes use of javascript to structoure and manipulate the data.

nos
A: 

Javascript is going to be the next more widely used application language. Why? Ask to Google Chrome OS Development team. Client side application and Cloud Computing aren't tell you something?

backslash17
A: 

The actual language of Javascript is ECMAScript. (See The standard and Wikipedia article).

ECMAScript is used in many browsers as Javascript, it's used in Flash as ActionScript, and Microsoft have their own implementation called JScript which is used instead of Javascript in Internet Explorer, and as a server side language in ASP (an alternative to the more common VBScript).

The language itself is not specific for any environment, like the web. The DOM that is used in Javascript is not part of the ECMAScript language itself. So, the language can be adapted to pretty much any environment, but the most widespread is of course still Javascript.

Guffa