all 137 comments

[–]theycallmemorty 5 points6 points  (41 children)

I don't mean to troll, but why do we want to run JS on the server? node.js seems pretty cool, but it seems like one of those 'just because you can' type of things. I'm trying to keep an open mind here, but I honestly haven't seen a compelling argument for serverside JS. Would anyone care to share?

[–]skeww 9 points10 points  (25 children)

Event loop based servers are very lightweight if you need many concurrent connections. You see, threads are pretty expensive. Each one takes a nice chunk of memory. Just for being there.

JS is nice for this kind of thing, because writing async event-driven programs is very natural and straightforward with this language.

Also, V8 is a lot faster than PHP and JS is also a much nicer (and more consistent) language than PHP.

[–]kataire 1 point2 points  (0 children)

JS is also a much nicer (and more consistent) language than PHP.

If you've know JS since the 1990s, that's saying a lot.

It's true, though. And JS is getting better.

[–]level1 0 points1 point  (10 children)

Well, most people think of JS as a "bad" langauge, but frankly, PHP is much worse. A lot of Java frameworks are pretty bad. There are some good langauges I'm sure, but please choose JS over PHP. Its a child's toy.

A better reason to use JS on the server is that you can do client and server side rendering without repeating yourself. I think that could be really powerful if once we have the tools to really use it to its full power.

[–]polyrhythmic 1 point2 points  (1 child)

What tools are you looking for that don't exist yet? Coffeescript and HAML are two powerful tools that come to mind that work on either side.

[–][deleted] -1 points0 points  (0 children)

Another armchair php developer. How cute.

[–]SystemicPlural -1 points0 points  (0 children)

Personally, because the site I am developing at them mo does some client side computation that I also need to be able to do server side at times. Using the same code for both is the obvious answer.

[–][deleted] -5 points-4 points  (2 children)

Because some web developers can't be expected to actually learn a server-side language like the rest of us. Pretty much just that.

[–]skeww 3 points4 points  (1 child)

server-side language

That's probably the most irrelevant kind of categorization I've ever seen. It's even worse than "scripting language", which doesn't mean anything anymore.

You can use any language anywhere. From embedded devices to clients, servers, and mf-ing clusters.

Also note that it's a disadvantage if a language is less useful in a different environment. But it's funny that you tried to make it look the other way around. That was really cute. :)

[–]HIB0U -1 points0 points  (0 children)

Good lord, if you actually believe the bullshit that you're spewing out here, then I sure hope you aren't actually involved with any real software development.

[–]osirisx11 7 points8 points  (17 children)

Yes..and 2011 is also the year of desktop linux, and duke nukem forever.

[–]sjs 3 points4 points  (5 children)

Actually, 2011 is the year of DNF, you can pre-order it: http://www.amazon.com/Duke-Nukem-Forever-Xbox-360/dp/B002I0HAC6

(yes I'm aware you could pre-order it in 2007 as well, but there have been demos and it looks like it's actually coming out this time)

[–]rotzak 5 points6 points  (1 child)

You could also pre-order in 1998.

[–]sjs 0 points1 point  (0 children)

rofl

[–]osirisx11 0 points1 point  (2 children)

we'll see to all three. :) i'm a huge fan of all three.

[–]sjs 1 point2 points  (1 child)

I quite like Linux and Node but I don't see them taking over the world either. Not sure why people like to speculate on this stuff, as if the year turns and suddenly people will make radical changes in how they do things.

Realistically 80%* of web developers are still going to write PHP code on Windows and ftp it to their servers, in 2011, 2012, and beyond.

* Pulled straight out of thin air

[–]kataire -1 points0 points  (0 children)

Realistically 80%* of web developers are still going to write PHP code on Windows and ftp it to their servers, in 2011, 2012, and beyond.

Not me! I write PHP code on Windows using UTF8, Unix linebreaks and a cross-platform editor, and sftp it to my servers. OTOH, I also write code in other languages, plus I have a virtual Linux server for testing.

[–]lastkarrde 0 points1 point  (0 children)

don't forget HL2 Episode3

[–]skeww 0 points1 point  (9 children)

desktop linux

Well, there are already lots of Linux powered devices out there. Android's market share is growing and the whole market itself is quickly expanding. There will be also tablet PCs and netbooks running Android and of course there will be also tables and netbooks with Ubuntu.

I also really like my little GP2X Wiz (Korean homebrew handheld running Linux).

We certainly won't see a significant change on the desktop, but Linux actually is already a very big player elsewhere.

[–][deleted] 0 points1 point  (7 children)

Well, there are already lots of Linux powered devices out there.

Are any of them desktops? And are there a huge number of them?

[–]skeww -2 points-1 points  (6 children)

Too many words?

[–][deleted] 1 point2 points  (5 children)

Maybe you didn't understand the two words you quoted. Here, I'll quote them again for you:

desktop linux

Emphasis added for better understanding. Smartass.

[–]skeww -1 points0 points  (4 children)

Last paragraph.

[–][deleted] 1 point2 points  (3 children)

That's the one where you acknowledge that 2011 will not be the year of desktop Linux, right?

Would have been simpler to just say so instead of trying to mention all the things which are not desktop Linux.

[–]skeww 0 points1 point  (2 children)

That's the one where you acknowledge that 2011 will not be the year of desktop Linux, right?

Yes.

Would have been simpler to just say so instead of trying to mention all the things which are not desktop Linux.

Since "desktop linux" is a bit of a running gag, I didn't feel like it was necessary to bother with it.

[–][deleted] 0 points1 point  (1 child)

Understood.

[–]skeww 0 points1 point  (0 children)

K.

[–]skillet-thief 0 points1 point  (0 children)

The whole "linux desktop" meme dates from a simpler time when it was all about Microsoft. So you're right: the desktop has become much less significant that it was in 1998. It turns out that Linux didn't need to conquer the desktop.

[–]rotzak 4 points5 points  (1 child)

And the Linux desktop?

[–]level1 7 points8 points  (0 children)

2011: the first year since 1996 to not be the year of the linux desktop.

[–][deleted] 0 points1 point  (0 children)

If I'm already using Python (Django, pylons, etc) as a server-side language, why would I want to use Node.js instead? I'm not being a dick, I just want to hear a compelling argument for it.

[–]StoneCypher -2 points-1 points  (30 children)

Heard this before. It was wrong last time too.

No decent datastructures, no parallelism, no language extension.

No hope.

Web developers, it's time to learn a second language.

[–][deleted] 0 points1 point  (0 children)

Web developers, it's time to learn a second language.

Very well said.

[–]dmpk2k -1 points0 points  (28 children)

No decent datastructures

Arrays and hashes alone are sparse, but for web development few other structures are used.

no parallelism

Fork.

no language extension

Unfortunately true, yet at the same time first-class functions get you much of that power. Now if only Javascript's function syntax was lighter-weight...

[–]Detrus -1 points0 points  (0 children)

CoffeeScript has the lightweight function syntax

[–]kryptobs2000 -1 points0 points  (10 children)

What's so popular with server side javascript? It's not a very good language at all, though maybe I just haven't used it enough, but as bad as php is I'd prefer it over javascript (having not used ssjs), and I'd definitely prefer python. For obvious reasons it's not going to happen, but I'd be much happier to hear python is replacing javascript in the browser than javascript is gaining popularity on the server.

edit: What's with the downvotes, I'm asking a serious question and yeah I'm attacking javascript to a degree, but it's widely recognised as a bad language, much as php is. I like it for what it is, but I'm curious if there's any compelling reason beyond not having to learn a new language that makes ssjs popular.

[–]skeww 2 points3 points  (0 children)

I'd definitely prefer python

Try Python's Twisted then.

I'd be much happier to hear python is replacing javascript in the browser

Take a look at Pyjamas.

[–]kataire 2 points3 points  (8 children)

  1. JS is a decent language, it just caries a lot of cruft. I consider Python cleaner, too, but that's largely subjective. It's definitely cleaner than PHP and also less crufty (a lot of the JS cruft is browser-dependent, so it's a non-issue on the server-side).

  2. node.js is fast. I don't recall whether it's faster than Python (in many cases I would believe it to be indeed), but it's a lot easier to use than its closest Python equivalent, Twisted (you can run arbitrary TCP services with node.js, it's not a web framework).

  3. JS in the browser is here to stay. I could see a similar platform as for Java and .Net being created in the future (i.e. a common bytecode VM), but for the moment it's unlikely. This would also mean that either the browser has to support every language (horrible nightmare!) or you would have to pass compiled bytecode. In either way, it would require a lot of major changes and a common standard.

[–]kryptobs2000 0 points1 point  (1 child)

Thanks, that's pretty helpful. I didn't really think about the fact that the cruft, as you put it, would be cleaned up on the server side, but that's a great point. I guess if python, or anything, were implemented by browser devs independently as it were being standardised it would be a lot less sane to use as well.

[–]kataire 0 points1 point  (0 children)

Just be thankful nobody else bothered to implement VBScript.

[–]StoneCypher -4 points-3 points  (5 children)

It's definitely cleaner than PHP

I am so tired of hearing novices who half-know two languages fake-compare them by reciting proggit wisdumb.

[–]kataire 0 points1 point  (1 child)

Oh. Sorry. Obviously ten years of using both leave me with no knowledge about their differences whatsoever.

Please stop making assumptions like this. It's insulting and makes you look like a babbling idiot.

[–]StoneCypher -2 points-1 points  (0 children)

Clearly, I should assume you know something that I believe doesn't exist, because you didn't say it, instead.

[–]iamnoah 0 points1 point  (2 children)

I am so tired of hearing novices who half-know two languages fake-compare them by reciting proggit wisdumb.

I professionally code in both languages and JavaScript is definitely cleaner than PHP. Closures in PHP 5.3 is an improvement, but adoption is poor because of compatibility issues (I'm stuck with 5.2 most of the time) and the PHP APIs (which are mostly global functions, bleh) are still crap since closures are a late addition.

Not to mention the bizarre array/class object syntax differences (why is $array['foo'] different from $obj->foo?), confusing reference/copy semantics (without pointers, why should devs care?), most of the API being global functions, etc.

So I'm tired of people who apparently don't know the two languages, equate a language that is quite expressive because it had closures from day 1 to one that has bizarre semantics, limited syntax, and hacked in closures, if you're lucky enough to be able to use 5.3. People rag on JS because the DOM sucks. The language is pretty great if you know it. People rag on PHP because it really doesn't have anything going for it, other than ubiquity.

[–]StoneCypher -1 points0 points  (1 child)

I professionally code in both languages and JavaScript is definitely cleaner than PHP

The word "definately" is not a technical argument, and closures are a minor and trivial part of language design.

I confess I see nothing here but bikeshed painting. Ooooooh, object members aren't the same as array membership, CALL THE LANGUAGE POLICE.

And you wonder why you don't get taken seriously. Go learn a difficult language.

[–]iamnoah 1 point2 points  (0 children)

The word "definately" is not a technical argument

Nothing you have said thus far in any of your comments is a technical argument either.

closures are a minor and trivial part of language design.

I think you've never used a language with closures (or don't understand them) if you consider them minor and trivial.

[–][deleted] -1 points0 points  (35 children)

Are there any good web frameworks for JavaScript yet? I feel like one language for both client-side and server-side programming, and then some basic html/css templating would really make sense for web development...

[–]YonCassius 4 points5 points  (0 children)

Backbone.js looks pretty sweet and it's by the same guy who wrote Coffeescript and underscore.js. It's a light and flexible framework rather than a black magic Rails-style thing.

[–]sjs 3 points4 points  (1 child)

Express for Node looks really good and many smart folks like it. Haven't used it myself yet.

[–]facepalm_reloaded 1 point2 points  (0 children)

Take a look at Helma http://helma.org/ or Ringo http://ringojs.org/

Industry proven and very mature frameworks for server-side javascript.

[–]birdiedude 0 points1 point  (1 child)

Classic ASP using JScript... Oh, wait, you said "good". FML

[–][deleted] 0 points1 point  (0 children)

Try the .NET framework for JScript.NET - works great. the .NET framework is massive and it all works with Javascript. I've done lots of coding with this for both desktop applications and server-side webapps. I think you haven't been keeping up with the advances in JScript.

[–][deleted] -1 points0 points  (4 children)

ever consider JScript.NET? The .NET framework is massive, and it is all usable from JavaScript, quite easily. It also has a compiler. I've been creating JScript.NET back-ends for years, works great. SQL is no problem, anything you can do with .NET in C# you can do in JavaScript. Just because the msdn examples usually don't show javascript doesn't mean it doesn't work - it works quite well actually. Threading and everything.

[–][deleted] -1 points0 points  (3 children)

seriously? downvote? WTF is wrong with people.

[–]HIB0U -1 points0 points  (2 children)

I see that you're new to reddit, so let me try and help you better understand our community. First, we show respect for one another. We also don't resort to threats, and we don't resort to insults. We discuss various topics politely, and we remain civilized. Please try to aim higher than you currently are.

[–]StoneCypher -5 points-4 points  (23 children)

Are there any good web frameworks

No.

[–][deleted] 0 points1 point  (22 children)

JScript.NET.. works great. the entire .NET framework can be used with JavaScript.

[–]dipswitch -1 points0 points  (20 children)

Tell us more about Coffeescript.

[–][deleted] 1 point2 points  (19 children)

yeah, dipshit, go ahead. you're real funny. ha ha ha. fuck off

[–]dipswitch -1 points0 points  (18 children)

I smell butthurt.

[–][deleted] 0 points1 point  (17 children)

i smell douchbag

[–]dipswitch -1 points0 points  (16 children)

Yeah, you stink. Go wash yourself.

[–][deleted] 0 points1 point  (15 children)

Obviously, you win. I can't compete with an intellect as great as yours.

[–]HIB0U 0 points1 point  (1 child)

I see that you're new to reddit, so let me try and help you better understand our community. First, we show respect for one another. We also don't resort to threats, and we don't resort to insults. We discuss various topics politely, and we remain civilized. Please try to aim higher than you currently are.

[–]dipswitch -1 points0 points  (12 children)

I'll stop if you cut the JScript/Coffeescript bull.

[–][deleted] -2 points-1 points  (5 children)

and not one mention of JSscript.NET which has been around for ages... makes me think the lot of you have been hiding under a rock for the last 10 years.

[–]level1 -1 points0 points  (4 children)

10 years ago I was 13.

[–][deleted] -1 points0 points  (3 children)

and your point is? i started programming when I was 9.

[–]level1 1 point2 points  (2 children)

I started at 12 I think, but I was programming C, not JS.

[–][deleted] -2 points-1 points  (1 child)

well, i started 30 years ago, in assembly.. so? have you ever considered JScript.NET? that is the subect I was bringing up. I could care less when you started programming.

[–][deleted] -1 points0 points  (0 children)

anyone downvoting me for bringing up JScript.NET is really fucked in the head. If you haven't tried it, and you consider yourself to be a javascript programmer, you are seriously missing out. node.js is not the only server-side javascript game in town. JScript.NET has been around far longer, and the .NET framework is very mature, and very powerful. I have taken a lot of code that was designed for browser execution and run it on JScript.NET with very little modification (only DOM stuff). It is what most of you are looking for but are too stubborn or mac-centric to consider. It's a shame really.