Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why server side Javascript is not widely used? [closed]

we know JavaScript is one of the most popular and widely used language in front end.i wonder it is not widely used in back end ?

like image 448
S.M.Karthick Avatar asked Dec 15 '10 14:12

S.M.Karthick


3 Answers

JavaScript is popular and widely used on the front end because it has critical mass, not necessarily because it's an excellent language. Nobody makes the decision to write JavaScript for client-side code; they simply must, because every browser supports it. On the back end, other languages (Java, PHP, Python, Ruby, ...) offer advantages that JavaScript can't.

Edit: In 2022, I received reputation for this answer, which inspired me to revisit it. Twelve years later, of course, JavaScript is commonly used on the server side, although in many cases it's a compilation target rather than being used. The engine for this has been Node.js. Along with a language like TypeScript or PureScript, you can achieve good performance and reasonable developer ergonomics, as well.

like image 172
asthasr Avatar answered Oct 22 '22 23:10

asthasr


It's becoming more widely used thanks to Google's V8 engine. Take a look at Node.js. I think poor performance limited it's effectiveness before.

Node.js lets you write multi-threaded custom web services in the blink of an eye and in a mostly OOP manner. I think you'll see that Javascript on the back-end is just beginning it's run.

I think the only thing holding it back is — as others have said — the lack of a neatly packaged and standardized (for Linux at least) drop-in solution. This solution would then need to be picked up by the major hosting companies and added as part of their product offerings for it to really take off IMHO. If that happens then I think you'll find that it will explode into the back-end server space.

Microsoft has offered the ability to program back-end systems with "Javascript" (AKA JScript) since 1998 with it's ASP offering. You still can develop ASP.NET applications with JScript. So it's nothing new. I think the reason it isn't widely used for ASP or ASP.NET applications is because VBScript is the "default" and C# seems to be the preferred language for more experienced professionals. But there is nothing stopping you except company policies which often restrict developers to a single language for corporate development. One reason JScript might not be used much by corporate entities is that it "appears no longer to be actively developed." In fact Microsoft never really "marketed" JScript to developers. Or at least not nearly as much as they did C# & VBScript. So I think that may have held it back.

like image 12
sholsinger Avatar answered Oct 22 '22 22:10

sholsinger


I'm not an expert on this, but Douglas Crockford says in "Javascript: The Good Parts" that JS essentially became popular in the browser by accident, not because of merit.

"Javascript is a language with more than its share of bad parts. It went from non-existence to global adoption in an alarmingly short period of time. It never had an interval in the lab when it could be tried out and polished... when Java applets failed, Javascript became the 'Language of the Web' by default. JavasScript's popularity is almost completely independent of its qualities as a programming language."

Different browsers implement it differently, and it's harder to say what's correct than it is for languages with a standard interpreter.

It does have good features, as Crockford's book explains, and node.js may prove that it's great for server-side development. But so far, where people have had choices, they've mostly chosen other languages.

like image 5
Nathan Long Avatar answered Oct 22 '22 21:10

Nathan Long