Does it make sense to build pure JavaScript based web applications (both client and server side)? [closed]
Asked Answered
G

7

16

I've always considered JavaScript as a great addition (or rather, for the last couple of years, as a must have) to the client side of any web application. Even when I started to use Mootools, which takes a big step away from DOM manipulation, and aims toward a general purpose, OO framework, I still didn't think that I would consider using JavaScript for server-side development. JavaScript belongs to the front, period - that's what I thought.

Well, it seems like according to some damn smart people, I was wrong. For the first time ever, the web development platform contest called Plat_Form accepted a team that used pure JavaScript both on the server and the client side. What's more, here is what the contest organizers had to say about this:

"We had a single application of a team, Upstream Agile, that will work with JavaScript on both the server and the client side. Since this might become a major trend in coming years, we consider their participation a glimpse of the future and accept this team even though no others with this platform have applied."

So my question is: is this really a viable concept, to build multi-tier web applications purely on JavaScript? If so, what would be the advantages of using JavaScript for both the front- and the backend?

EDIT: The link in Vanwaril's answer (Why node.js is totally awesome) reveals an interesting discussion in the comments section that worth reading through. I, for one, have decided that though using Javascript on the server side is a viable concept and might have its benefits, I would definitely not start building an enterprise application with that architecture. At least for now. This question might need to be asked again in a year, I can imagine that the answer will dramatically change in the near future.

Glynas answered 8/2, 2011 at 10:2 Comment(0)
V
12

First off, have you taken a look at node.js? JavaScript is one of the languages that, over the last few years, has seen leaps and bounds of development, and its likely to keep growing.

In terms of functionality, it is less mature when compared to other server-side technology, but the active community is making it not far behind.

Finally, since its a language that runs on both the front and back-end, its implications for code-reuse and data-exchange formats make application development a whole lot faster.

I'm not sure its quite ready for production yet (unless you yourself are willing to contribute to the code-base) but server-side JavaScript is a good option to experiment with.

Vulnerable answered 8/2, 2011 at 10:10 Comment(3)
node.js looks sweet, I have to admit! Thanks for the link and your insights.Zeeland
Hmmm, V8 is fast, but I have to wonder why other Javascript engines that sit atop of more mature web stacks don't seem to have nearly as much momentum.Stenophyllous
@Stenophyllous node.js brings something new and exciting to the table: full async. the other engines (I work with/for RingoJs) are more traditional and as so far 'less sexy'.Olson
C
5

Unhosted is a "project" that is fully about javascript-only applications that run in the web browser only and use server just as storage for (encrypted) data. You will find some examples there.

Cistaceous answered 9/6, 2011 at 8:51 Comment(0)
V
5

To actually answer the question - yes, it is perfectly viable to build client-server web applications entirely in JavaScript, and frameworks that got traction in the intervening two years since the question was asked -- notably Meteor -- make this much easier than it used to be:

One Language. Write both the client and the server parts of your interface in JavaScript.

-- http://docs.meteor.com

Vachell answered 12/3, 2013 at 1:37 Comment(0)
O
4

We are building our CMS & frontends using http://Helma.at, currently serving ~ 250 mio pages / month. This is JavaScript through & through.

Note that this is not bleeding edge technology, as you seem to assume: Helma is in development since 1998 and we use it in production since 1999.

Olson answered 18/2, 2011 at 9:19 Comment(2)
Thanks for this, I'm guilty as charged, I really assumed that this falls on the bleeding edge side.Zeeland
that's not the site i'm talking about.Olson
I
2

So my question is: is this really a viable concept, to build multi-tier web applications purely on JavaScript?

Yes, although the tools are relatively immature when compared to many other languages.

If so, what would be the advantages of using JavaScript for both the front- and the backend?

  • No switching between languages for developers
  • Code reuse (e.g. Want to check that data is sane? The same code can be used on the client and the server).
Illusionist answered 8/2, 2011 at 10:5 Comment(0)
C
2

Server side code has to be particularly robust and well engineered, as it manages more than one client in a multi threaded environment. The complexity of business tier processes and the need for accurate code re-use has always lead me to write server side code in Java. I would not consider using Java script because it is aimed at a different usage.

That being said I do use Java script at the server for replicating client side validation scripts for example. That way you can use the one piece of validation code at both ends. The user gets responsive browser validation but the back end re-validates in case someone bypasses the front end validation.

Congregationalist answered 6/11, 2013 at 6:47 Comment(0)
C
1

This is not a new idea. In fact its so old to have been in fashion then gone out and is now coming back again.

Clasic ASP on windows server IIS can use javascript as the server side scripting language. it can talk to local filesystem and SQL sever etc. very very simple stuff.

You could easily write some ASP code that returns JSON to be consumed by your client side script ajax.

The problem is that MS have ignored classic asp and moved to asp.net (c# or VB.net) so we have to wait for the community to re-invent server side javascript to get back to where we where in 2001.

Cutinize answered 17/3, 2011 at 12:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.