Live data from Hacker News

JavaScript: It’s Not Just for Browsers Any More

pragprog.com

11–20 of 93 posts

Re: JavaScript: It’s Not Just for Browsers Any More

#12
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

For me it is about consistency. With javascript on the client and the server, it's easier to write code once and move it around. Compared to having to write perl, java, php, whatever on the server side and javascript on the front.

It reduces the learning curve for new developers because they only have to learn javascript, not javascript plus something else.

Re: JavaScript: It’s Not Just for Browsers Any More

#13
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

Like others are mentioning, Javascript is clean, familiar, easy, and has some compelling language features to boot (closures, JSON, etc).

Cultural norms and design patterns in Javascript Land increasingly orbit around projects like jQuery. This sort of influence works out spectacularly-well if you've spent the last several years working countless hours on browser-side code and suddenly stumble on nodejs and its evented/closure style of programming. Perhaps this doesn't describe you, but from my vantage point, this describes a vast number of programmers. There are a lot of people in that demographic who want to be able to rapidly write out web apps in the same frame of mind client and server side and not have to switch to thinking in Python or Ruby.

The fact that V8's engine is competitively fast isn't hurting these efforts either.

Re: JavaScript: It’s Not Just for Browsers Any More

#14
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

Here's Yegge on the topic:

http://steve-yegge.blogspot.com/2007/02/next-big-language.ht...

... though he doesn't explicitly say he's talking about Javascript, it's pretty likely that he's talking about Javascript.

1) It's got C-like syntax.

2) It's got the dynamic- and functional-language features that make people happy.

3) We're stuck with it no matter what. Changing the world's installed base of web browsers takes about a decade; such is the lesson of IE6. The only universally-supported client-side language on web browsers is Javascript. Its successor, should it exist, hasn't even been sighted on the horizon. [1] So we're in for at least another decade in which every web developer needs to know Javascript.

4) Because of #3, lots of folks are working to make Javascript fast and reliable. There are several JS interpreter projects in active competition. That kind of focus has already paid off in spades, and is going to pay off even more over time. Those of us who remember the days when Java was considered painfully slow, to the point where people complained about how crippled it was, understand what happens when the bulk of the world's compiler wizards spend a decade optimizing a language's runtime: It tends to become better. Much better.

---

[1] The only serious challenger, Flash, is not only proprietary, widely loathed, suffering from a PR slump, and under direct attack from Apple but is also... based on ECMAscript, a.k.a. Javascript. Or so I understand. So it's more of an alternative runtime than a real alternative language.

Re: JavaScript: It’s Not Just for Browsers Any More

#15
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

Primary reason is, especially when used with something like CouchDB is absolutely no data transformation. What's in the DB is exactly what jQuery gets on the front end. See this:

http://labs.mudynamics.com/2009/01/14/js3/

Re: JavaScript: It’s Not Just for Browsers Any More

#16
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

Currently, JavaScript is the only thing I can actually convince customers to use in place of PHP, which has various weaknesses that make it a terrible choice for certain apps. The killer argument is that there are lots of people who already know JavaScript.

Re: JavaScript: It’s Not Just for Browsers Any More

#18
If I have:

do_thing_A_and_after_that_call(function() { do_thing_B_and_after_that_call(something); }

do_thing_C_and_after_that_call(function() { do_thing_D_and_after_that_call(something); }

what should I do to execute some E after both B and D is finished?

I think that non-blocking effectively means introducing easy syntax for parallel execution while complicating syntax for sequential execution.

I think parallel and sequential execution should be easy: on T1 and T2 do E where T1 = (A; B), T2 = (C; D)

Re: JavaScript: It’s Not Just for Browsers Any More

#19
post #5

Why do we want javascript on the server side, when we already have so many other options? I'm not trying to imply something against this aproach, this really is a question.

Here's Yegge on the topic: http://steve-yegge.blogspot.com/2007/02/next-big-language.ht... ... though he doesn't explicitly say he's talking about Javascript, it's pretty likely that he's talking about Javascript. 1) It's got C-like syntax. 2) It's got the dynamic- and functional-language features that make people happy. 3) We're stuck with it no matter what. Changing the world's installed base of web browsers takes…

In a talk Yegge gave some time later he did confirm that he was talking about JavaScript. http://vodpod.com/watch/395703-steve-yegge-at-oscon-2007 (at the very end, "NBL is JavaScript 2")
Post reply on HN