Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
El Marrow
Jan 21, 2009

Everybody here is just as dead as you.
I've perused COBOL for a few months now, and I haven't seen any heavily Node.js-oriented threads. Has this just not been covered with a megathread, or does COBOL just dislike Node?

I'm so confused.

Adbot
ADBOT LOVES YOU

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

El Marrow posted:

I've perused COBOL for a few months now, and I haven't seen any heavily Node.js-oriented threads. Has this just not been covered with a megathread, or does COBOL just dislike Node?

I'm so confused.

Node.js is stupid and the community is poo poo.

ExcessBLarg!
Sep 1, 2001
There's a particular fondness for it in the coding horrors thread.

sarehu
Apr 20, 2007

(call/cc call/cc)
I contributed to Node.js in its early days (just a simple bugfix) and have regretted it ever since.

See also What the hell is going on in webdev land

FakEdit: Good god that thread is from 2013.

El Marrow
Jan 21, 2009

Everybody here is just as dead as you.

Bruegels Fuckbooks posted:

Node.js is stupid and the community is poo poo.

It's incredible how staggeringly wrong you are.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

El Marrow posted:

It's incredible how staggeringly wrong you are.

Like, the idea behind node.js is offensive to me. "Let's take javascript, and run it on the server." gently caress, man, seriously? I don't like Ruby on Rails or Django either but the world didn't need a bunch of assholes trying to get javascript to run on a server. They also like trying to make a "native like" platform for web apps, but using javascript for the user interface. There are better tools for doing both of these things. Just because it's possible to write anything in loving javascript doesn't mean it's a good idea.

sarehu
Apr 20, 2007

(call/cc call/cc)
El Marrow, what other tools have you used for web development?

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
pre:
<sarehu> .q dentist 66
<skybot> sarehu: [66/90] 2013-10-24 <dentist> that's why node.js exists: terror at the thought of having to
learn another language (because JS is so full of pitfalls that they assume all languages are this bad)

more like dICK
Feb 15, 2010

This is inevitable.
NodeJS is legacy. Please refer to the io.js thread, OP.

sarehu
Apr 20, 2007

(call/cc call/cc)

Avenging Dentist posted:

pre:
<sarehu> .q dentist 66
<skybot> sarehu: [66/90] 2013-10-24 <dentist> that's why node.js exists: terror at the thought of having to
learn another language (because JS is so full of pitfalls that they assume all languages are this bad)

An appropriate number for that 16-bit opinion on a 32-bit language.

pigdog
Apr 23, 2004

by Smythe

Bruegels Fuckbooks posted:

Like, the idea behind node.js is offensive to me. "Let's take javascript, and run it on the server." gently caress, man, seriously? I don't like Ruby on Rails or Django either but the world didn't need a bunch of assholes trying to get javascript to run on a server. They also like trying to make a "native like" platform for web apps, but using javascript for the user interface. There are better tools for doing both of these things. Just because it's possible to write anything in loving javascript doesn't mean it's a good idea.

I don't know much of Node but the tech lead of quite a successful local startup gave a talk about why they use it, and they have some good points. Javascript and node.js are made for and optimized for the web and networking from the ground up, rather than relying on libraries. Most developers need to know Javascript anyway these days, so why not use it on server. Very easy to create and integrate with JSON/RESTful services, because duh. The runtime is very lightweight compared to JVM and that of many other languages. Compile times don't exist, so devs are more productive and deployment is easy. NPM is pretty cool. It's single-threaded but asynchronous, so you get many benefits of multithreading but without the complexity and caveats. They said they design what components they can to be stateless and just run [number of CPU cores] instances of node (behind some kind of load balancer?), and if that works, then they can easily scale it to many servers as well. Etc.

Deus Rex
Mar 5, 2005

pigdog posted:

Very easy to create and integrate with JSON/RESTful services, because duh.

Would you mind elaborating on this point? Why is it "duh"?

sarehu
Apr 20, 2007

(call/cc call/cc)

pigdog posted:

Javascript and node.js are made for and optimized for the web and networking from the ground up, rather than relying on libraries.

Javascript is not optimized for networking at all. It's not optimized for the web either (not sure what you mean by optimization, but if you mean in terms of language design... from a web server perspective, it certainly is not). Node.JS is not optimized for networking either. It has a networking library, like anything would have.

pigdog posted:

Most developers need to know Javascript anyway these days, so why not use it on server.

Because of reasons, such as callback hell being worse than using threads, and being dynamically typed being worse than being statically typed.

pigdog posted:

Very easy to create and integrate with JSON/RESTful services, because duh.

Actually, it's because there's a JSON parser in the library, and an HTTP server, just like there is with other languages/frameworks you'd use for web development. Being Javascript gives it no special privileges to either aspect.

pigdog posted:

The runtime is very lightweight compared to JVM and that of many other languages. Compile times don't exist, so devs are more productive and deployment is easy.

Or you could use other languages that are better, also have lightweight runtimes (except you're running a server so having the JVM is not a problem) and you have to hit a deploy script anyway, it's not like you're editing files in place.

pigdog posted:

NPM is pretty cool.

If it's so cool what is Bower for, and don't Python or Ruby or Java and the like have ways to get packages too? Yes, they do.

pigdog posted:

It's single-threaded but asynchronous, so you get many benefits of multithreading but without the complexity and caveats.

You get the complexity and caveats of event-based programming, which is what multithreading solves. Guess what caveats you get of multithreading: there aren't really any if you're writing a sane web app that only talks to a database and global caching stuff, and doesn't have request handlers sharing global state.

pigdog posted:

They said they design what components they can to be stateless and just run [number of CPU cores] instances of node (behind some kind of load balancer?), and if that works, then they can easily scale it to many servers as well. Etc.

Which is not some Node-specific solution or good thing about Node.JS.

MrMoo
Sep 14, 2000

IBM have integrated Java and COBOL, I would not be in the least bit surprised to see Node.js and COBOL, oh wait.

pigdog
Apr 23, 2004

by Smythe
The point is they are making do with Node and without threading, in several datacenters and servicing hundreds of thousands of users -- and scaling across servers is more important anyway. No doublt they could have just as well written the thing in COBOL, but node.js seems to be working for them and that's cool.

For what it's worth npm is rather neat and effortlessly handles version conflicts which in the Java world be jar hell.

El Marrow
Jan 21, 2009

Everybody here is just as dead as you.

sarehu posted:

El Marrow, what other tools have you used for web development?

SERVERSIDE:
C# / ASP.NET
VB.NET
C + cURL
Python / Django
Ruby / Rails

CLIENTSIDE:
Angular.js
jQuery
Knockout
Ember.js
Handlebars
Atom Shell
EJS
ERB

Deus Rex posted:

Would you mind elaborating on this point? Why is it "duh"?

Because it's a natural fit to have your serverside code natively speak the same language as the services you're drawing or sending data to/from. Duh.


Bruegels Fuckbooks posted:

Just because it's possible to write anything in loving javascript doesn't mean it's a good idea.

You're right, but in this case, it's a fantastic idea. Node.js achieves mind-blowing benchmarks, is remarkably stable, and it allows an entire dev shop to work in the same language across the stack. If you've ever managed a development team, you'll immediately see value in this.

more like dICK posted:

NodeJS is legacy. Please refer to the io.js thread, OP.

I was really hoping someone would bring up io.js! :)

sarehu posted:

Javascript is not optimized for networking at all. It's not optimized for the web either (not sure what you mean by optimization, but if you mean in terms of language design... from a web server perspective, it certainly is not). Node.JS is not optimized for networking either. It has a networking library, like anything would have.

And it's almost poetic that its benchmarks and usability blow almost everything else out of the water.

sarehu posted:

Because of reasons, such as callback hell being worse than using threads, and being dynamically typed being worse than being statically typed.

Which is a matter of opinion. Mine being that if you're afraid of callbacks, you're a pussy.

sarehu posted:

Actually, it's because there's a JSON parser in the library, and an HTTP server, just like there is with other languages/frameworks you'd use for web development. Being Javascript gives it no special privileges to either aspect.

That's funny. Last time I checked, you had to import a JSON module into Python to do that.

sarehu posted:

Or you could use other languages that are better, also have lightweight runtimes (except you're running a server so having the JVM is not a problem) and you have to hit a deploy script anyway, it's not like you're editing files in place.

You're right about better languages. Javascript + Node is the ultimate in settling. Sorry, but the JVM is ALWAYS a problem. Everything about the Java ecosystem is worse than cancer.

sarehu posted:

If it's so cool what is Bower for, and don't Python or Ruby or Java and the like have ways to get packages too? Yes, they do.

And none of them have accumulated as many robust and maintained packages in their history as NPM has. As far as NPM vs Bower, perhaps you should take a look at how their dependencies are structured. You might find your answer there.

sarehu posted:

You get the complexity and caveats of event-based programming, which is what multithreading solves. Guess what caveats you get of multithreading: there aren't really any if you're writing a sane web app that only talks to a database and global caching stuff, and doesn't have request handlers sharing global state.

Which is not some Node-specific solution or good thing about Node.JS.

That's cool. Let's compare benchmarks and scalability. In my last position as chief architect of a startup in Atlanta, I ran concurrency and scalability tests until my eyes bled. My jaw hit the floor when I was able to attain 270ms transaction times on high-throughput requests to 250k simulated concurrent users. The beauty of Node in this regard is the event loop, which is the same reason why Nginx is vastly faster than Apache.


Edit: This post came off as a bit salty ;) To each his own.
There are two things in this industry I can't stand:
1. People who are intolerant of other people's languages
2. Java

El Marrow fucked around with this message at 01:06 on Feb 19, 2015

triple sulk
Sep 17, 2014



El Marrow posted:

Node.js achieves mind-blowing benchmarks

lmao

ExcessBLarg!
Sep 1, 2001
sarehu already covered the gamut is his rebuttal, but here's more.

pigdog posted:

I don't know much of Node but the tech lead of quite a successful local startup gave a talk about why they use it,
So first off, node has only been around in a useful form (one that you would consider building an extensive platform on, if you're willing to consider that in the first place) since 2011. So I imagine that said startup is only 3-4 years old, or their core platform isn't based on node. Either way, that's not really long enough for a startup to feel the pain of maintenance burden and code bases exceeding the size and scope for which they were originally designed.

pigdog posted:

Most developers need to know Javascript anyway these days, so why not use it on server.
Front-end web developers need to know JavaScript, yes, but not general software engineers. Also front-end and back-end engineering are fundamentally different, so it's not clear that the same people should be involved in both aside from lack of resources.

Also, JavaScript is a terrible language. It's tolerated on the front-end due to necessity and the fact that there's nothing that can replace with the same degree of browser compatibility. That said, it's been around long enough in web browsers that frameworks have sprung up to make it suck less. In contrast, there's few constraints on which language/framework to use on the server, and thus, there exists a variety of mature, well-thought-out language/framework combinations. Here, node doesn't provide anything fundamentally new at all, aside from the novelty of "having the front-end and back-end in the same language!"

pigdog posted:

Very easy to create and integrate with JSON/RESTful services, because duh.
I assume "duh" is based on the fact that JavaScript interpreters "natively" interpret JSON. Except that JSON isn't a subset of JavaScript, and even when we can pretend it is, evaling JSON is a massive security hole. Thus JSON is parsed in JavaScript the same way it is in every language, by using a dedicated parser.

pigdog posted:

Compile times don't exist, so devs are more productive and deployment is easy.
There's a lot more to proper release engineering than compiling code. Usually the compilation stage is a short and uneventful anyways, and where it's not, it's for good reason (there's a bug in your program).

pigdog posted:

NPM is pretty cool.
Package management is cool. It's not cool when the npm package registry is down.

pigdog posted:

It's single-threaded but asynchronous, so you get many benefits of multithreading but without the complexity and caveats.
Except complexity like trampoline code and caveats like deadlocks and jittery response times when your blocking I/O (it's still blocking even if node pretends it's not) gets delayed for whatever reason.

So, the deal here is that mature languages support both threading and event-driven models, so you can write code using whichever approach is better suited for your purpose. Node only supports the event-driven model because V8 doesn't support multiple threads. Node hipsters spin the "async sauce" as an advantage, but honestly it's a major limitation of the platform that is, at best, a neutral point for folks who really believe that event loops are always superior to threads.

ExcessBLarg! fucked around with this message at 01:20 on Feb 19, 2015

Steve French
Sep 8, 2003

Is 270ms supposed to be impressive?

ExcessBLarg!
Sep 1, 2001

Bruegels Fuckbooks posted:

Node.js is stupid and the community is poo poo.
That's the other problem. New node releases regularly break code, and stupid drama has already resulted in the platform being forked.

Deus Rex
Mar 5, 2005

El Marrow posted:

Because it's a natural fit to have your serverside code natively speak the same language as the services you're drawing or sending data to/from. Duh.

I don't follow: if the language you're talking about is the language the applications behind those services was written in, I'm not sure I see any advantages or natural fits unless you're using some kind of language-specific RPC mechanism. If the language you're talking about is JSON, unless I misunderstand something about the relationship between JSON and Javascript it seems to me that Javascript doesn't offer any particular advantages over other languages in "speaking" JSON.

astr0man
Feb 21, 2007

hollyeo deuroga
It's because the J in JSON stands for JavaScript duh

El Marrow
Jan 21, 2009

Everybody here is just as dead as you.

Steve French posted:

Is 270ms supposed to be impressive?

With 250k concurrent users on a single box? LOL YEAH. I'd say so.

Gawd drat. The elitism is strong here.

Steve French
Sep 8, 2003

El Marrow posted:

With 250k concurrent users on a single box? LOL YEAH. I'd say so.

Gawd drat. The elitism is strong here.

Concurrent users is not meaningful by itself.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





El Marrow posted:

That's cool. Let's compare benchmarks and scalability. In my last position as chief architect of a startup in Atlanta, I ran concurrency and scalability tests until my eyes bled. My jaw hit the floor when I was able to attain 270ms transaction times on high-throughput requests to 250k simulated concurrent users. The beauty of Node in this regard is the event loop, which is the same reason why Nginx is vastly faster than Apache.

were you running on like an arduino? your chromebook?

Steve French
Sep 8, 2003

What is a high throughput request

Star War Sex Parrot
Oct 2, 2003

I guess the OP closed this out of shame. I don't like that.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
I thought a mod closed it for being a bullshit magnet.

Huragok
Sep 14, 2011
I use Node for most of my side projects, but would I write a 10k SLOC webapp in it? No.

Like has been touched upon, the callback hell is so very bad. It makes the developer have to reason about code much more and looks ugly as all hell. ES6 and ES7 (promises and async/await) will go far to help alleviate this hangup.

pseudopresence
Mar 3, 2005

I want to get online...
I need a computer!
Hi guys, great thread! I'm a bit of a Node 'newbie' but I can tell you that if you don't like callbacks, there are blocking versions of all the IO library calls :) That's what I'm using for my current project, a FreeBASIC to C++ compiler written in Node.js.

Huragok
Sep 14, 2011

Fib posted:

Hi guys, great thread! I'm a bit of a Node 'newbie' but I can tell you that if you don't like callbacks, there are blocking versions of all the IO library calls :)

Thus obviating the raison d'être of using node in the first place.

Coffee Mugshot
Jun 26, 2010

by Lowtax

Fib posted:

a FreeBASIC to C++ compiler written in Node.js.

lol

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I like the idea of using node to pre-render JS frontend stuff on the server. Having two different sets of view rendering code sucks, and so does serving a blank page that turns into an actual page five seconds later.

Stoph
Mar 19, 2006

Give a hug - save a life.
Node.js is nice because it gave front-end web development a decent package manager to rule them all. Not sure if I'm much of a fan of it for API endpoints though... getting proper stack traces from Node.js exceptions is not very easy.

Node.js fits better as a proxy/middle-tier if you really want to use it on the server, backed by an API written in something else.

Stoph fucked around with this message at 01:15 on Feb 26, 2015

Gul Banana
Nov 28, 2003

Plorkyeran posted:

I like the idea of using node to pre-render JS frontend stuff on the server. Having two different sets of view rendering code sucks, and so does serving a blank page that turns into an actual page five seconds later.

this is a genuine use case for javascript on the server - but it might still not count for node. using node for ssr, you have the overhead of process creation and startup on every web request - or at best, serialised ipc.. to a manually managed pool of processes since they're each single threaded. that's a good way to waste hundreds of milliseconds and hit scaling bottlenecks. it's easier just to embed v8 or some other javascript engine in-process of whatever you're using for the server.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Gul Banana posted:

this is a genuine use case for javascript on the server - but it might still not count for node. using node for ssr, you have the overhead of process creation and startup on every web request - or at best, serialised ipc.. to a manually managed pool of processes since they're each single threaded. that's a good way to waste hundreds of milliseconds and hit scaling bottlenecks. it's easier just to embed v8 or some other javascript engine in-process of whatever you're using for the server.

honestly, maybe there's really a use case for doing something like that (like having to support IE8 or some other bullshit), but talking about pre-rendering javascript on the server to "improve performance" is a big sign that I'm going to have to throw out the project and start from scratch - up there with "javascript caching and data layer." Both are signs that you have old people trying to do front-end work.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Bruegels Fuckbooks posted:

honestly, maybe there's really a use case for doing something like that (like having to support IE8 or some other bullshit), but talking about pre-rendering javascript on the server to "improve performance" is a big sign that I'm going to have to throw out the project and start from scratch - up there with "javascript caching and data layer." Both are signs that you have old people trying to do front-end work.

Uh, pregenerating the HTML for the initial page load (instead of just sending down data and having it generated client-side) is a totally worthwhile thing to do for reducing page load time. Unless by "old people" you mean "people who care about performance" or something?

(Your users care about performance. This is objectively measurable.)

Gul Banana
Nov 28, 2003

search engines are also a big fan of crawling pages with actual content, rather than an empty <div id="react-mount">

Funking Giblet
Jun 28, 2004

Jiglightful!

Bruegels Fuckbooks posted:

honestly, maybe there's really a use case for doing something like that (like having to support IE8 or some other bullshit), but talking about pre-rendering javascript on the server to "improve performance" is a big sign that I'm going to have to throw out the project and start from scratch - up there with "javascript caching and data layer." Both are signs that you have old people trying to do front-end work.

No. Just no.

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Gul Banana posted:

this is a genuine use case for javascript on the server - but it might still not count for node. using node for ssr, you have the overhead of process creation and startup on every web request - or at best, serialised ipc.. to a manually managed pool of processes since they're each single threaded. that's a good way to waste hundreds of milliseconds and hit scaling bottlenecks. it's easier just to embed v8 or some other javascript engine in-process of whatever you're using for the server.

Embedding v8 in your main application server would probably be better, but it certainly wouldn't be easier than using pre-existing solutions. A load-balanced node worker pool that doesn't add hundreds of milliseconds of latency is a rather solved problem, and since it doesn't need to be public-facing you don't even really need to be able to scale the worker pools.

  • Locked thread