7 ms·
Why I love Node.js
- nailer 11y agoJS land is pretty sweet right now: npm is fantastic (particularly on the frontend), ES6 and ES7 finally extend the language to include basic stuff like multiline strings & array.includes(), server-side DOM manipulation makes a bunch of possibilities possible, the post-react virtual DOM libraries are making data binding and components simpler than ever, node and iojs merged, we have an LTS node, I could go on: things are better now than any time in the last 5 years.
- gavinpc 11y ago> server-side DOM manipulation makes a bunch of possibilities possible Can you explain what this has to do with node.js? I've done server-side DOM manipulation for years, in both .NET and Python.
- nailer 11y agoYou can run well known client libraries on the server with little or no modification, and testing them is also easier since you can pop open DevTools and prototype code rapidly.
- tbrock 11y ago> npm is fantastic We must live on different planets. Our eng team and CI tool needs to run npm install multiple times to coerce this lumbering beast into writing all of our requirements into a directory. Every time it unreliably installs my dependencies as specified (after declaring exact versions required in my package.json) I scream into the void "you had one job!". It's a frequent cause of frustration for me despite providing access to a wonderfully colorful library of software. Availability of packages on npm and in the larger JS ecosystem is at an all time high and yes, JS as a language seems to be doing well, but npm is, in my opinion, in dire need of some tlc.
- sosuke 11y agoI made a batch file to run npm 3 times when they had a bug in assuming atomic file actions. They have fixed this bug and the latest versions of npm. It only happened on cloud servers for me and it was assumed a result of slow IO highlighting the bug.
- tbrock 11y agoEh I'm not sure that is the same problem. We could reproduce this behavior on everything from MacBook Airs to honking i7s with fast SSDs as well as the cloud.
- nailer 11y ago> Every time it unreliably installs my dependencies as specified (after declaring exact versions required in my package.json) Declaring exact versions in your package.json doesn't make installs consistent. An example: A's package.json says A needs exactly B version 1.2.0 B's package.json says B needs C version 2 or newer C can be any version. shrinkwrap will help you with this. It's better in npm v3 (install updates shrinkwrap by default)
- deleted 11y ago[deleted]
- tbrock 11y ago
- EGreg 11y agoThe best thing about JS are the debugging tools in Chrome!
- brightball 11y agoI'm not a big JS guy, but I totally support what this guy is saying here. Use what works for you. JS is a fine choice for some things. It wouldn't be my preference, but you don't have to make decisions based on my preferences.
- romaniv 11y agoMost developers don't control their tool-chains. Plus, some tools act like black holes for software. They bend all the infrastructure around themselves and there is no coming back once you cross the adoption event horizon.
- cal5k 11y agoThis is perhaps the best analogy I've read all year! ...and I've read quite a few.
- fennecfoxen 11y agoI'd actually say that JavaScript is the weak point of Node.js. It's got some good points, to be sure, but there's plenty of pitfalls (let's talk string concatenation vs addition, for instance) and the new language extensions of ES6 add more opportunities for confusion until people are very well adapted to them. But as far as providing a nice nonblocking event loop, and a consistent ecosystem built around that event loop, it's pretty neat.
- sametmax 11y agoPretty much. Node is amazing. Too bad the Google genius had to work with JS. Thing about what they would have accomplish if they had to create a V8 for a decent language...
- wut42 11y agoIt's not complicated to love nodejs when you come from PHP…
- pluma 11y agoAs a former Pythonista who currently likes JS a lot after having used it practically nonstop for the past three years... what do you say to me then?
- pikzen 11y agoI can understand not wanting to work with Twisted.
- knodi123 11y ago"How dare you talk to me?"
- dplgk 11y agoI say... can you show me the light? I love django...it's no bullshit and no frills yet has everything I need. Node.... is hellish. Callbacks haunt me. New tools come out every day. The JS dev process is so over-engineered.
- manyxcxi 11y agoCallbacks, arrow code, error handling, and the daily shifting sands of the JS landscape really pained me when I was first getting my bearings with node but I was determined to build a continuous deployment server with it until I was happy with my feature set and comfortable with node. I was going to be building the system no matter what, but I figured it was the best time to learn node and that the async-ness of the language would be a huge benefit (it mostly was). Eventually, I found my rhythm and I now really like node (it's been three years). It has a lot to do with picking packages that are stable, or at least have responsible leadership, and a modicum of documentation. You get used to minimizing arrow code, and you learn to pass errors until you run into that one obscure darned library that throws them (or leaks them) and you have to write a bunch of stuff to seal it up. The deployment system runs great, and I really like writing tiny to medium sized worker applications, parsers, scrapers, and web services with node. I find running node in production to be a bit of a chore compared to Python, PHP, and Java- but like all things JS it's evolving and I'm still learning.
- pikzen 11y ago>NPM is something other languages are jealous of. Nothing to bad. Oh boy am I jealous of NPM. A package manager that pulls libraries with so many files that it frequently breaks MAX_PATH on Windows and Linux. And the alternative is the newest NPM, which makes builds no longer deterministic. Quality engineering right there. From both NPM devs and library devs. > I don’t see why node should be worse than some of them… especially php? Comparing a shit sandwich to a turd cake. They're both terrible. > curl randomfuckingwebsite.com/scriptz.sh | sh Web development at its finest. Your sysadmins must love you. >That’s it… everything is up and running! And I didn’t even had to kill my system with nginx/apache Either the author means that you need to restart nginx to start up your application (hint: you don't), or he means that nginx sucks CPU time (hint: not as much as node). He then proceeds to list libraries for features... I suppose the point is that there are very few languages with such good integration? That's not because of node, that's because the Meteor guys have actually worked to make a nice process. RoR does things very similary, you don't see me praising Ruby for that >Praise for React. Yeah, the DOM is a piece of shit, congrats, we've known that for years. >No one wants to use windows 95 any more That is the cherry on the fucking pie. Then why does Flux (which is going to be used with react at least half of the time) use pretty much the same message loop as Windows 1.0 ? Oops, that's right, because it's simple and efficient. That "hurr durr iz old iz bad" mentality is what is holding everyone in development back. Stop. That. Shit. >Perhaps it is, but for me it’s more convenient to use javascript everywhere. "I don't want to learn a new language / The awful language that is Javascript is enough for me." OK if your argument is the second, Holy-shit-why-are-people-like-you-allowed-to-be-developers if it's the first. To use the very own words of the author, "there has to be some value in this, i thought and started reading." There wasn't. ------------------- Now that the rant is over, the author is right on one point: Use whatever works for you. EDIT: I am having a lot of fun watching the vote count on this post fluctuate up and down. Please continue.
- goldenkey 11y agoI'd like to nominate you as the Deadpool of HN, language abated, I do like the passion that your 'corrections' exude. And amen, just use whatever works. Programming is a means to an end.
- 11y ago
- SadWebDeveloper 11y agoFor toy projects and fast prototyping... JS ecosystem looks awesome but for enterprise grade software it looks like: toy for kinder garden developers. Mostly cause the enterprise love to support legacy software from 5 years ago (your nice webapp won't work that fast on IE8) and requires minimal support for the next 5 to 8 years. Web Development future looks fragile IMHO.
- brndn 11y agoThe kindergarten developers at Netflix and PayPal (to name a few) use NodeJS in production.
- joshmanders 11y agoI'm sure Netflix, PayPal, Walmart, LinkedIn, Uber, New York Times, Medium, IBM are all kinder garden developers.
- SadWebDeveloper 11y agoEveryday amazes me that people actually think that when an a "Big Corporation" announces a new technology adoption they actually believe they rewrite everything for that new technology and don't consider it a PR/SnakeOil/Smokeware movement.
- joshmanders 11y agoYou do realize these companies have posted blog posts explaining the benefits of them doing just what you say they don't do... PayPal's Mobile.de team blogged about rewriting their Java system in Node.js and how performance was improved and how much faster they can work. Netflix has also blogged about similar experiences. Walmart blogged about how they rewrote their site in Node.js and was able to handle traffic on Black Friday way better than with previous systems. PayPal themselves wrote about rewriting the account dashboard in Node and how it improved things. This isn't snake oil or a PR movement. These are real companies using Node.js to make their businesses better. Uber talks about how their whole infrastructure is built on Node.js IBM bought Strongloop, self proclaimed "The Node.js Company".
- wslh 11y agoThe last time I criticized Node I was heavily downvoted here (downvotes already started here too! Please educate me, I am here to learn), so I will proceed with caution now: We developed some applications in Node, it is a headache to maintain an application that uses an SQL database (e.g: MySQL) because the code for executing a transaction involving several queries is unreadable afterwards. We use the module async to have some kind of readability but there are many implicits where small errors are natural to occur. On the positive side, I found some specific modules in the cryptocurrency space that are not available in other programming languages. This is why we are playing right now with Trireme and Edge.js to use Node modules from Java or .NET.
- EGreg 11y agoCan you explain? Due to Node's evented architecture, you should be executing all the transaction code in ONE sql query -- otherwise the transaction can be interleaved with other queries!
- wslh 11y ago(downvotes started here too! please educate me instead of downvoting, I am here to learn) Yes, that is an additional issue that I suppressed for my comment trying to narrow the criticism to executing several SQL queries in a readable and maintainable way. I will not expand on how we solved that specific issue, just say that the transaction in question is fired by external events that can't be fired until a previous one finished. But, following your suggestion about executing all the transactions in one SQL query, how do you do this without using a store procedure? Because we were thinking in using store procedures but we couldn't implement all the logic inside the transaction with a SP. This is where other languages solve the problem but I couldn't find a concrete solution in Node, so any suggestions will be very appreciated.
- EGreg 11y agoI was also worried I'd need stored procedures (which MySQL requires root privileges to create) until I realized (by trying) that felixge's mysql module (and probably others) simply accept queries with multiple statements :-D So that solved it for me!