Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is JavaScript an application language?

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?

like image 289
nexa Avatar asked Aug 15 '09 18:08

nexa


2 Answers

Serverside Javascript has been possible for a long time now. I maintain code 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 form 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 sent as plain text. That is not true for .js files, which are only executed if they are included in an .asp file.

like image 122
Esteban Küber Avatar answered Oct 06 '22 12:10

Esteban Küber


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.

like image 38
tvanfosson Avatar answered Oct 06 '22 14:10

tvanfosson