why server side Javascript is not widely used? [cl

2019-03-25 03:18发布

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 ?

7条回答
闹够了就滚
2楼-- · 2019-03-25 03:31

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.

查看更多
闹够了就滚
3楼-- · 2019-03-25 03:31

Short answer: Because there are far better alternatives.

Long answer: Because it is wholly interpreted (and often not well - e.g. IE6), provides no standard I/O mechanisms other than what the environment gives, has a loose grammar that results in difficult to verify code, and many people find prototype-based OO a lot harder to deal with than class-based OO.

查看更多
Fickle 薄情
4楼-- · 2019-03-25 03:33

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.

查看更多
叛逆
5楼-- · 2019-03-25 03:35

On the server people are not obliged to use a specific language, and JavaScript is so free-form that code becomes very difficult to maintain.

That's why the largest percentage of people choose something else.

查看更多
对你真心纯属浪费
6楼-- · 2019-03-25 03:40

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.

查看更多
一夜七次
7楼-- · 2019-03-25 03:41

I'd say it's just an accident of history. Javascript was born at Netscape as a client-side language and never made the transition.

Comparing it to the prominent server-side web languages today, I think the most obvious difference is that the batteries aren't included with Javascript. There is no standard library.

Compare that to Python, PHP, ruby, etc which all have fantastic standard libraries that make web programming far more palatable.

查看更多
登录 后发表回答