


Ask Slashdot: Have You Migrated To Node.js? 341
A developer maintaining his company's "half-assed LAMP / WordPress stack pipeline for web and web application development" is considering something more scalable that could eventually be migrated into the cloud. Qbertino asks Slashdot: Have you moved from LAMP (PHP) to Node.js for custom product development and if so, what's your advice? What downsides of JS on the server and in Node.js have a real-world effect? Is callback hell really a thing? And what is the state of free and open-source Node products...? Is there any trend inside the Node.js camp on building a platform and CMS product that competes with the PHP camp whilst maintaining a sane architecture, or is it all just a ball of hype with a huge mess of its own growing in the background, Rails-style?
Condensing Qbertino's original submission: he wants to be able to quickly deliver "pretty, working, and half-way reliable products that make us money" -- and to build a durable pipeline. So leave your educated opinions in the comments. What did you experience moving to Node.js?
Condensing Qbertino's original submission: he wants to be able to quickly deliver "pretty, working, and half-way reliable products that make us money" -- and to build a durable pipeline. So leave your educated opinions in the comments. What did you experience moving to Node.js?
Have you migrated to qbasic? (Score:4, Insightful)
Fuck no, it's a toy language that's being stretched way beyond its intent. JS has become the absolute bane of the internet, which now requires 2ghz machines to render ~~responsive~~ web pages, and the language has no place whatsoever on servers.
Re:Have you migrated to qbasic? (Score:5, Funny)
JS has become the absolute bane of the internet
JavaScript is a horrible language, as you can see [opentechschool.org]. But PHP is also a horrible language. If you are writing a lot of JS for the client side, then node.js has the advantage that you only need to learn one horrible language.
Re: (Score:2)
My experience with Node.js is that database migrations are a pain compared to Rails. Use the best language for the domain you're working in. Server side and client side design patterns are different.
Re: (Score:2)
The difference is that I can use many languages on the back end to develop web apps. I'm stuck with Javascript, a really really shitty shitty language, for anything that runs on the browser. But like many shitty pieces of technology, it gained adoption and thus continues, each iteration just as fucking terrible as the last.
Yes, I know there are alternatives, but at the end of the day they still compile down to javascript.
Re:Have you migrated to qbasic? (Score:5, Informative)
See, I don't get all the hate towards JavaScript. From what I've seen, it's a perfectly usable language except for the lack of true classes, and even that flaw can be fairly easily worked around if you're a C programmer who did OO back before it was cool (function pointers).
What makes client-side JavaScript a nightmare is not the language, but rather the DOM, which is kind of a pain in any language. The biggest difference is that in other languages, most developers never have to deal with the DOM....
Re: Have you migrated to qbasic? (Score:4, Insightful)
Re: Have you migrated to qbasic? (Score:5, Informative)
No.
We don't like Node because Javascript is eccentric (read: benignly insane) in too many ways. If there was an alternative, that would be adopted in a heartbeat. Something with sensible types and type casting at least, preferably with a better, non-prototype object model.
Re: (Score:3, Insightful)
Re: (Score:2)
What else? Two words: global variables. If you've done any javascript, you know what I mean. Or have you ever tried to do any arithmetic in javascript [imgur.com]?
Re: (Score:3)
How can NaN === NaN? Their only commonality is that they are both not a number. Zebras and Oranges are also not numbers - should they be equal to each other?
Re: (Score:2)
Re:Have you migrated to qbasic? (Score:5, Informative)
That said, it's not significantly worse or better than most other mainstream programming languages.
Re: (Score:2)
I think the killer feature of Node.js is that you have the same code on client and server, which makes the mental overhead for a 'full stack developer' smaller. But now Dart, Typescript, Clojure/script, Scala, and many oth
Re: Have you migrated to qbasic? (Score:2)
Yo yo node.js hipsters Erlang is the real rockstar language man!! [youtu.be]
Re: (Score:3)
You jest, but Erlang actually delivers what node.js promises (pun intended).
Re: (Score:2)
Yes, we've migrated, but it doesn't run on the server. It's used to run gulp which precompiles our LESS files to CSS, minifies the CSS and JS, makes bundles out of them, and optimizes our images. I wouldn't actually run the thing on a server, but it's great as a development build chain.
Re: (Score:2)
Re: (Score:3)
It would need to if web designers would stop making webpages into flashy bling bling crap. Honestly the moment a webpage uses node,js someone should hit the webmaster with a sack of doorknobs.
If your website takes more than 4 seconds to load on a 5mbps internet connection, then it's designed by a freaking noob that should not be allowed near a webserver.
It's not that bad, just don't write PHP with JS. (Score:5, Informative)
I come from a strong C++/Java background and was drug into the Node/JS world kicking and screaming. It's still not my platform of choice but at least I don't despise it anymore. A few things:
1. Don't try to write PHP (or C++/Java/etc) with Javascript. You see a lot of people try to force Javascript into their way of programming and that's where a lot of the callback hell comes from. It's an event driven environment, just repeat that over and over.
2. Take the time to familiarize yourself with ES6/Promises/Rx before you start. Promises vs. Rx is almost a religious discussion but when you get down to it, both do the job. This helps a lot with callback hell.
3. After you've chanted it's an event driven environment often enough, start chanting everything is a stream [slides.com].
3. Use eslint religiously. This will find a lot of the mistakes new programmers make, especially ones coming from other languages.
Absolutely not, and never will (Score:2)
The only upside of Javascript is that it is available everywhere. (and kinda functionaly-sh)
Everything else about that language is horrible.
I barely tolerate it inside the browser, most of the time thanks to NoScript, not even that.
So why the hell should I start putting this nonsense on servers?
On servers I typically use C++ if I can, Java is the clients demands it, Haskell if I feel playful (Yesod is really great), Common Lisp if I feel like experimenting (Hunchentoot is interesting), Python if I feel lazy
Re: (Score:2)
Re: (Score:2, Informative)
Use a transpiler then.
Write in a better language then compile to JavaScript / ECMAScript.
ECMAScript is probably one of the worlds WORST languages out there.
How about Coffee Script or TypeScript then transpile to JavaScript for deploying?
Re: Absolutely not, and never will (Score:2)
I was aware that the state of Javascript development is pitiful, but the recent incident where the pulling of a simple String-padding library crashed hundreds of other projects outdid even my worst fears.
That really had little to do with JavaScript as a language and more to do with NPM, the package manager for NodeJS. I get that you'd love to hold that against JavaScript. I just think you'll have to find another reason.
Re: (Score:2)
Interesting blog about node.js here:
http://geekforbrains.com/post/... [geekforbrains.com]
some quotes:
"All this to say that it feels like the Node ecosystem is constantly moving. Not in a good way. New tools that âoetrumpâ old tools seem to come out daily. Theres always a new shiny thing to replace the other. Youâ(TM)ll be surprised on how easily this happens to you and the community seems to encourage it. You use Grunt!? Everyone uses Gulp!? Wait no, use native NPM scripts!
Packages that consist of trivial code n
Uh... (Score:2)
...no.
But I never migrated to lhe LAMP disaster either.
Re:Uh... (Score:5, Funny)
Re: (Score:2)
I'm think he's using Tomcat...
Re: (Score:2)
Re: (Score:2)
LAMP is not a disaster if you choose a good P. There at least two decent mainstream choices (although users of either will cast aspersions on the other). Although, upgrading the M to P won't hurt, either.
Re: (Score:2)
I don't evev know what it is (Score:5, Funny)
Nope. Can't be arsed. Even if I could, by the time I learn it it'll be obsolete & replaced by something with a retarded name like Cunt%% or something.
Re: (Score:2)
...by the time I learn it it'll be obsolete & replaced by something with a retarded name like Cunt%% or something.
Jim Jeffries, is that you?
Much respect (Score:5, Funny)
Now that's a honest business person!
Re: (Score:2)
"[W]orking, and half-way reliable" are mutually exclusive.
The real question (Score:5, Insightful)
The real question is why, and what would be gained from doing so?
This would be a major project, is the return really going to be worth the investment of time and energy?
I think there is often a desire, rational or not, among programmers to want to redo things and make them "clean" (whatever that means) and more efficient. It's a laudable notion, but it's often outweighed by the amount of work required to re-code everything from scratch. I've rarely found it to be worth the time and effort, frankly.
My guess is that he'd be better off optimizing some of the choke points, or perhaps implementing one of the many existing development platforms. That may require some modification, but it would still probably be a better way to go about it. It's unlikely that his needs are so out-of-band or unusual that a standardized solution wouldn't work (again, even if it required some customization).
Wanting "Something potentially scalable and perhaps even ready for zero-fuss migration to an entirely cloud-based platform" sounds very buzz-wordy to me, and that's a red flag in my book.
Finally, the statement that "it's about correctly building a pipeline that won't be completely outdated in 10 years" seems to be pure wishful thinking.
Good luck with that- I doubt ANY development environment is going to survive for ten years. That's an eternity in the world of coding and development. Tools get outdated as capabilities and needs expand and mature. Hell, I doubt I'll even be using the same text editor in 10 years, let alone an entire development environment.
Re: The real question (Score:2)
"an eternity in the world of coding" (Score:2, Interesting)
Code lasts a surprising amount of time compared to the mindset of the mainstream programmer. You know, the payroll stuff running on mainframes, embedded stuff running everywhere, that sort of thing. The short timespans we see on the "consumer" side, moreso on "web" and "apps" and "cloud" and other buzzwords. In fact, html5 is all about moving on from previously working stuff and "upgrading" to the latest fad. That's why it's branded a "living standard".
Anyhow, php and mysql are rotten pieces of crap and so
Re: (Score:2)
Local Governments with no budgets have to make their custom software last for an insane amount of time before they can get a replacement. I know of one still running Dos & a Novell 3.1 server. Web apps seem a good way to keep things standard across a variety of aging and ancient computer systems. I do not necessarily mean that NodeJS is the answer here just that using the web (internally) seems to be a longer lasting solution then a platform dependant one (say windows app). With Node at least the govt I
Re: (Score:2)
arghh sorry "Novell 3.11"
Re: (Score:2)
Let me guess? Drywalled into a space with no doors?
2 was netmare, but 3 was sweet.
Re: (Score:2)
just that using the web (internally) seems to be a longer lasting solution then a platform dependant one (say windows app).
Agreed...although browsers may come and go and change, the underlying stuff will probably stand the test of time. There's no reason you couldn't build a web app that would (*SHOULD*) still work 5 or 10 years from now. But his idea of keeping everything the same for a decade is probably unrealistic.
Re: (Score:2)
The real question is why, and what would be gained from doing so?
Given that they're currently on Wordpress, I'd think there's a good possibility they are already on the "reinvent the web wheel every few years" treadmill. So if I were talking to this guy, before I attempted to answer the question he asked I'd first ask another question - why did you move to Wordpress in the first place? Where you trying to address some existing problem(s), or was it just "hey Wordpress is popular right now so I'd like to learn it"? I suspect the latter; but, if the former was actually the
Re: (Score:2)
Or look at some other CMSs.
Node.JS is nto a replacement for Wordpress.
Re: (Score:2)
Or look at some other CMSs.
Node.JS is nto a replacement for Wordpress.
Yep. A modern CMS may last for quite a while, especially if they're committed to managing in house over the long haul. But it also sounds as though they have some custom dev tools that are going to be time-consuming to replace, so it might be better to fix what they can while transitioning to something that's already available rather than coding the whole thing new from the ground up.
Re: (Score:3)
And WordPress is antiquated, poorly written garbage that survives mostly because designers live for its theming ecosystem. Anyone that has actually read that heaping plate of spaghhetti code (with its big, juicy meatballs of bad practice and thick backwards compatibility sauce) knows not to touch WP.
Re: The real question (Score:2)
It's more than an eternity in the NodeJS world. Since the libraries and frameworks are under active development by a bunch of people that are happy to make backward compatibility breaking changes, it's likely that they'd be stuck on an archaic version indefinitely. That isn't making it future-proof, it's making development a constant task (as it is with any software that is in continuous use for a long time), except it will be more extensive than normal maintenance (which is 95+% of the time in the lifecycl
Re: (Score:2)
It's really interesting because if you look at PyPI, you'll see a lot of this too, but not universally. Some projects exercise some degree of release management discipline and multiple supported branches and such. Others are managed like you describe, just a constant stream of whimsical updates.
Across the industry there is a very *vocal* sentiment, particularly among newcomers, that stable branches and release management in general is for the birds. We have unit tests and continuous integration now, so w
Re: (Score:2)
I think there is often a desire, rational or not, among programmers to want to redo things and make them "clean" (whatever that means) and more efficient. It's a laudable notion,
Also, it is all too common the programmer overestimates what the quality of the redo would look like, *especially* if they are looking at redoing someone else's code. They think 'ok, this is way more convoluted than it has to be', and then realize way too late they were wrong.
Even more so when they think part of making it 'clean' *requires* reimplementation in another language. Now there may be valid reasons to reimplement in another language (better matching your available talent pool, better performance
Re: (Score:3)
Good luck with that- I doubt ANY development environment is going to survive for ten years.
I've been using the same dev environment (mostly) for the last twenty years. Sure, I've updated my vimrc/emacsrc, I've copied my Xresources to newer machines and I've backed up my GNUStep directory and restored on newer machines over the years.
My workflow has remained exactly the same - edit/make/deploy[1]/test/repeat. I don't use an IDE, my 16-virtual-screen WindowMaker desktop *is* the IDE.
[1] Deploy means anything from "push to test-server" to "program the device's flash with new firmware".
(Yes, I know
Re: (Score:2)
Yeah, that stuff is ancient and annoying, lacking severely in useful features. Everyone worth their salt is using vim.
Node what? (Score:4, Insightful)
Re: Node what? (Score:3)
Web applications are popular because you can deploy them instantly to all your users and they work across multiple platforms including mobile with little tweaking. Good luck doing that with a "proper" application.
Re: (Score:2)
you have to be kidding ? (Score:4, Informative)
I used node for a while, I should have known better, but it sure made a change. Not a good change, but definitely a change. I think this explains it pretty well: https://www.youtube.com/watch?... [youtube.com]
There are two kinds of people (Score:4, Insightful)
2. Those who are surprised when their shit breaks because someone on the other side of the internet sneezed.
There is little reason to "migrate" (Score:2)
Aside from its benefits, Node.js has some substantial dangers. The whole npm model of no locking by default and fuzzy matching is a security disaster in the making.
Re: (Score:2)
Short answer: dont (Score:4, Interesting)
A lot of people are spewing a lot of well-founded hate at the node platform, but the comments are missing a lot of substance.
Node is just ok. What it is amazing at is doing lots of asynchronous IO, and has some libraries that make this pretty easy (i.e.: async). When all you need to do is read files and hit APIs and write files it's great.
Now node has a lot of shortcomings. For one, it's really not that fast when doing actual processing. If you need to do any kind of remotely complex calculations, including things like html template rendering (handlebars), data structure transformations or even like zipping/unzipping, it's slow as a dog. And since data calculations aren't IO, async operations actually start to slow you down. AND, unless you explicitly do things in an async manner, your whole node process will lock up and only that one task will execute, which can cause all kinds of latency issues with your app.
One can argue that ruby, etc suffer from the same fate and that's why you have multiple processes running. But because of node's async nature, if you are using a web framework like express, each process will potentially be handling multiple clients. And process that's processing will cause those clients to get slower responses and any crash will kill all of those clients.
There is also the mess that is npm, where it becomes very easy to have a 700MB dependency directory which SUCKS to deploy to multiple servers.
That's just my experience as a node Dev for the past 18 months.
Yes and it is actually harder to maintain... (Score:3, Informative)
There are more poorly-written libraries and more fragmentation in the Node.JS space than there is even in the PHP world. Beyond this, it's like developing on dev code. They've made major fundamental changes to Node in the last couple years that we've been using it that we have to almost completely rewrite our code every year or so to keep anywhere near current.
I wouldn't change. It feels like a flash in the pan tech, it's just that developers are available for it and development is pretty rapid if they use decent front-end libraries.
If I had it to do over again, we'd use front-end JS libraries with a more traditional server-side language that isn't like developing on quicksand where fundamental functionality changes require completely redesigning/developing your site code all the time.
Comment removed (Score:5, Interesting)
Re: (Score:2)
possibly (Score:2)
Migrated probably isn't the word. But my company has done some pilot projects from scratch in Node. There are some advantages:
There are some disadvantages:
Conflictng requirements (Score:4, Informative)
If you want to create new web applications quickly, especially ones where you rely on a REST design, node.js is fantastic. With express js you can build things with very few lines of code, and if you respect the REST spirit you won't feel like the asynchronous thing is a problem. Just find Promise-based libraries for your database layer and you'll find the whole thing very smooth. Although I find the default templating library (jade) totally unusable, which is why I usually use swig; that's something to keep in mind if you do a lot of server-side html generation (as opposed to single page apps).
As an added bonus, with a nginx/node combo you'll get better performance than with Apache/PHP and it's even easier to configure. (Although to be honest you could use nginx/fpm to get almost the same performance). Performance matters because it's easier to scale in a cost-effective way. You can start with a smaller host (like one of those $5 virtual machines on AWS) and provision as many of them as you need.
Unfortunately this beautiful agility comes at a cost: node is not a stable ecosystem and unless you're extremely diligent in managing your dependencies, there's no way you can expect the same code base to live for 10 years. Just like bower and other packagers, npm is great and solves a lot of problems, but it relies on houses of cards built upon houses of cards. Libraries hat depend on librairies are more nimble but at the end of the day you will be the one left with a pile of garbage once a few building blocks start to erode. And with npm it's totally normal to have core libraries built by one guy in his basement who doesn't maintain his masterpiece; you don't see it because each "npm install" does all the magic, but really it can be nerve-wracking when something goes wrong and you start digging for weird error messages caused by cross-dependencies in two underlying libraries you didn't know you were using. At least with PHP frameworks there's usually a somewhat structured community.
I don't pretend this is highly scientific but based on my experience, here's fhe difference between the same web application written in different programming languages:
-Asp.net takes 25% less code than j2ee
-PHP takes 50% less code than Asp.net
-Node takes 75% less code than PHP
However when it comes to long term maintenance:
-nothing comes even close to java in terms of stability. I will happily debug a war created in 2002 and figure out ways to work around old jdk issues.
-there is zero way to debug an Asp.net web application created with an old framework; just finding an IDE that will support it without trying to upgrade it (and failing at it) would prove nightmarish. And it keeps moving forward like this.
-I'd rather drink a tall glass of melted butter than debug something written in PHP3, especially with the bad mixes of html, includes and mysterious variables that may or may not come from another file.
-As for node, it's probably easier to rewrtie an app created two years ago than to try and fix it.
Maybe things will change; PHP is becoming more mature and at some point people will get fed up with the throw-away nature of node js and some stability will appear. Until then: for quick & dirty stuff node is the best, and for long term maintenance java is king. I don't see immense value in sticking with stuff like PHP, RoR or Asp.net, but to each his own.
Re: (Score:2)
Regards, a Perl developer.
I've done my share of Perl years ago, including cgi web applications with mod_perl. Back in the days I was all for it, telling whoever who'd listen how slashdot and imdb were success stories of Perl on the web.
Back then it was an okay technology, but it didn't age well and never got the kind of good frameworks that make rapid development of complex applications possible in other ecosystems. I don't know why someone would still write web applications with Perl today, unless they're unable or unwilling to kee
Very happy with NodeJS (Score:2)
We replatformed a legacy C# app to a modern stack including Node.JS, and are very happy. The "win" wasn't so much the Node.JS language itself as that it was part of a platform that gives us fantastic code development velocity and fluidity. The "stack" includes CircleCI and Docker, MongoDB and Mongoose, Node.JS for a thin web services layer, and Angular (JavaScript) for the user experience, all integrated into HipChat for "ChatOps". Selenium and BrowserStack for end-to-end testing.
I'll agree that JavaScript
Slashdot quality has improved in leaps and bounds (Score:5, Interesting)
David has shortened my Ask Slashdot significantly (no hurt feelings here what-so-ever), but the effort he put into his edited post is heart-warming and his preservation of the gist of my Node.js issue is spot on.
I've noticed that the quality of the editing work done on Slashdot ever since the newest crew took over is off the charts compared to everything before and I'd like to take the occasion to give a huge warm applause to the new crew and the work these guys are doing. You folks freakin' rock and I've never felt such pride in being a long-time slashdotter as I feel right now. I wish you a nice stream of revenue and happy times as the new herald of slashdot, you guys are off to a spectacular start in my book. BRAVO!
I'm actually going to point out to my geek buddies who've since abandoned slashdot (Whimps! :-) ) that now if ever is the time to return. Simply seeing slashdot soar to new heights is a pleasure in itself.
As for the discussion on my question - great input, folks.
And, btw., needs to be said after 17 years of slashdotting: You guys rock too. Of course. Naturally.
Javascript is going away (Score:5, Interesting)
Soon, you will be able to write front-end code in any language you like, you won't need to use Javascript. And if you're not using Javascript on the front-end, there's really no reason to use it on the back end.
Re:Javascript is going away (Score:4, Insightful)
WebAssembly and Emscripten are really cool technologies though. But in no way a threat to JavaScript.
The reason Javascript is popular is because in the browser, it's the only option. Once WebAssembly is widespread, that will no longer be a reason to use Javascript. That is my reasoning for explaining why Javascript will no longer be popular.
Why do you think people will still use Javascript once they have other options?
Re: (Score:2)
Why do you think people will still use Javascript once they have other options?
(1) Inertia, and (2) code base. COBOL, and to some extent Fortran, are still around because of the huge amount of code nearly everywhere that would be way too expensive (and in some cases impossible) to recode. You also have to retool people and dev environments if you're going to jump to the latest/greatest way to slice bread. Not a fan of JS, but I don't see it disappearing any time soon.
Re: (Score:2)
Re: (Score:2)
Personally i don't see any problems with JavaScript.
None at all? You might want to look into that blindspot.
There are things in this world that I think are just awesome, but even then there are at least some problems.
YAM2C (Yet Another My Two Cents) (Score:2)
I dove straight into Node.js to develop a platform around 3 years, I don't regret using Node.js, in fact I am glad that I used it. I essentially used the MEAN stack (MongoDB, Express, Angular and Node.js). It was great to:
1) use JS everywhere: back-end (including the DB) and front-end.
2) use JS: it's fun (for me) - if you use the right parts. And it performs fast enough, on par with PHP, if not faster.
3) have an experienced community - JS and Node.js has gone through it's teething issues already.
4) do a
So much hate for JS, but I love it (Score:2)
I'm one of those older coders who started out with assembly language, did some BASIC, APL, Ridl, etc, before finding Java, then Javascript. I've seen enough PHP to scare me. I've written enough Ruby to be used to its quirks. I've been writing Javascript since 1997 and it's still my go-to language for when I need to get something done quickly and reliably. I've taken code that took 12 hours to run in Ruby and turned it into a simple Node script that ran in 6 minutes. Like Ruby and Java there is a real cult
Use Node for what it is good for (Score:3)
Node is very good for processes that hit a database and/or file-system with "simple" manipulation. You will have to think asynchronously, and you will want to learn promises. Where it shines is when you have a lot of simple things to do during a method, and you can do those things concurrently. It's great for squeezing out every last ounce of CPU/core capacity - which can be priced at a premium if you are on "the cloud".
For web-hosting, you can use something like Express, and implement it with clustering to scale out to your server's capacity with regard to CPUs/cores. This gets very clunky, very fast, much more so than PHP or even ASP.MVC. It seems like a solution looking for a problem. I'd avoid it.
One of the better implementations I've seen of Node is in AWS. You can upload a Node package to their Lambda service, and trigger based upon a schedule, S3 (file) event or an inbound web call (via API gateway). It pretty much scales "auto-magically". But there are limitations. You have some utilities like Ghostscript available, but you are mostly limited to the version they have on their server images. You can include your own executables (by building them in an EC2 instance), but this increases your package size, load time, etc. If you want to use Node for a website, I'd probably limit Node's use to webservices (AJAX) for hitting the database and business logic; and drive your site's UI using a client-side engine (Angular, react, etc.). You can use it very effectively for back-end processes thumbnail generation, email notifications, etc.).
For "quick & dirty" websites, I'd probably avoid Node, unless you are going to drink the "cloud Kool-Aid" (especially with AWS Lambda); then Node might be a fit if you are going to craft custom sites where scalability and cost management are significant considerations.
node.js is fine (Score:2)
Node.js is neat. We have a production service running on it that handles a couple of hundred thousand messages a day sent by tens of thousands of devices. It's not much, but it's only about 700 lines of javascript. That's including comments and whitespace.
The callback mechanism takes some getting used to. If you haven't programmed interrupt handlers or async I/O it'll be confusing, because the flow-of-control isn't really that obvious.
Why did we choose node? Our understanding was that it's great at concurre
With regard to the durable pipeline (Score:2)
improve instead of reinvent (Score:3)
A developer maintaining his company's "half-assed LAMP / WordPress stack pipeline for web and web application development" is considering something more scalable that could eventually be migrated into the cloud
How about replacing it by a less-assed LAMP stack? You know, the answer to a broken wheel is not to sit down and reinvent the wheel. Generally, it is faster, cheaper and smarter to simply get a proper wheel.
I've refactored projects, both successfully and with failure. This is one area where the old estimate rule-of-thumb (take your best guess, double it, then increase the order of magnitude by one, i.e. replace hours by days, days by weeks, weeks by months, etc.) is so absolutely true. If you have a working pipeline, no matter how bad it works, you will dramatically underestimate the effort it takes to rebuild that pipeline on a different technology.
Sometimes it is worth the effort. Typically, not. Replacing wordpress with something non-broken is probably ten times faster and easier than reinventing the whole thing.
Re: (Score:2)
No, that's the fun thing about asynchronous programming: nothing runs in parallel at all. It all runs in the same thread. You can add worker threads, but JIT engines weren't designed for multiple threads, as well as browsers, so its not done.
Maybe with languages like Rust in which you can do actual proper multithreading without stepping onto your toes (even better than in Go!) this might change, but its a long time until servo takes off, a very long time.
Re: (Score:2)
Ruby and javascript are both crap, because they are barely strongly typed, and you have to unit test everything in order to have *some* guarantees about your code. It might just outright crash because you wanted to call a number like a method. Or worse, it might continue execution but with unintended consequences.
Putting js onto the client is one thing. It is sandboxed in one of the the world's best sandboxes and it can't do much harm there.
But having it on the server, where it processes user data and decid
Re:Ruby Community / Rails is hardly "a mess" (Score:5, Interesting)
I've had to learn some Ruby to support automated testing written in Ruby and Cucumber.
I hate Ruby.
Ruby feels like someone took Perl and intentionally made it even worse.
The syntax is awful. Pipes and hashes and at symbols everywhere. The documentation is not good. Many packages - I'm sorry, "gems," because we have to be cutesy - don't have documentation at all, not even in the source code. Typing? What's typing? Everything is an object! That's all the type you need, right? Curly braces? Pffft. Those are to passe. You need to close things with an 'end'. Methods with ? in the name? Sure, why not. It gets really fun when you're using that character as a method name and an operator.
I can forgive the anti-curly-brace thing, but everything else about the language feels like it was developed by an 8 year old watching bad hacker movies. So much language-specific crap that does utterly nothing to enhance readability or ease of development.
The day I never have to touch Ruby again will be a great day.
Re: (Score:3)
You don't need to.
Both have correct Ruby syntax.
Re: (Score:2)
Ruby Runtime (Score:3)
There's actually not a lot in Ruby that you can't modify at runtime. You can't break variable assignment, and I don't think you can erase the concept of class inheritance, but most other components are up for grabs. It's perhaps not quite as flexible as Lisp or Smalltalk, but there's definitely no shortage of hanging rope. Metaprogramming Ruby was an enlightening look at how this can be put to practical use. Personally, I think that "monkey patching" is grounds for "developer punching", but there are a grea
Re: (Score:3)
Agreed. a PHP Programmer calling Ruby a mess is just deluded or plain stupid.
Re: (Score:2, Insightful)
I looked at node.js because we needed something for an embedded linux project. reading up on it I saw the callback idiom and thought why would anyone want to do that to themselves?
Re:Yes callback hell is a thing (Score:4, Interesting)
Because when you need to get the page built and back to the user in 10ms, you control path through the program must be explicit and direct, both for the normal control flow, and the error path
And because the alternative to single-threading is multi-threading, and that sounds like a great abstraction until you realize how much time is lost acquiring and releasing locks, and performing context switches. And you see your code complexity balloon because you have to deal with all the cross-thread synchronization. And it's hard to test.
The alternative to single-threading is a system which can interrupt the current page build with the _next_ page build (multithreading!) and that almost always makes things worse.
Node.js responds to server overload by rejecting page requests because it's busy - something the outer load balancer can deal with in milliseconds. (You have a load balancer, right?) Multithreaded programs respond to overloads by slowing down, running out of stack space and crashing. If you're running a real-world web app with thousands of users, one of those is worse.
Re: (Score:2)
Re:Yes callback hell is a thing (Score:5, Interesting)
As pointed out, Promises are the primary solution to Node's "callback hell". People like to hate on the explicit value/error return separation, but that's merely a convention used by the top-level HTTP components, not actually baked into the language. It makes something explicit that is usually implicit.
The thing is, if you language has Exceptions and try/catch then you already have an implicit equivalent of the success/fail control split, and anyone trying to properly handle exceptions caused by their exceptions finds themselves merely in the circle of hell next door.
I've coded in node.js for a couple of years now, written some semi-big pieces of software to do real-time message passing/transaction processing stuff. It was fine. It's better than PHP, which I moved from. It's better than writing cgi-bin programs in C++, which is how I started. On of the big reasons to use node.js is it nicely integrates alternative protocols like WebSockets, RTC, AMPQ, so you can roll up a "web server plus other protocol" system that gets a lot of jobs done you just can't accomplish with PHP/Apache.
People love to hate on Javascript because they don't like admitting the language wars are over, and Javascript won. When you can walk into a room and ask "How many people have a compiler on them _right now_." and people answer "I've got at least two!" Try that with any other language. Compilers shipped, lines written, active users... JS wins on all metrics. It's not the "best" language, but then, what is?
A last note... node.js works especially well in 'cluster' situations, because to be honest, your average node.js process isn't terribly reliable. Individual node.js programs will crash on a weekly basis, thanks to funny net errors. In a cluster that doesn't matter, and in fact you WANT your 'nodes' to fail-fast rather than hang waiting for a deadlock. 'forever' restarts the errant script in seconds, but in those seconds your load-balancer should be handing the task off to another node. It's a paradox that to get a reliable cluster, you want your individual parts to be quite twitchy and explody., which node.js is.
Re:Yes callback hell is a thing (Score:5, Interesting)
It's a paradox that to get a reliable cluster, you want your individual parts to be quite twitchy and explody., which node.js is.
I think I get what you're saying, but somehow I don't expect this argument to convert any nonbelievers :-)
My personal favourite JS verdict is from Verity Stob, over at The Register,
CON: The most dysfunctional functional language. On top of all its well-known flaws that disrupt ordinary primitive programming, it lacks many allegedly must-have functional gewgaws. Its variables are mutable, its type holes are indubitable, its 'eagerness' unsuitable, its modules are inscrutable, tail recursion disputable, scoping inexcusable, and I'll stop there, with 'refutable' (to name but one) still in the bank, just because you were kind enough to beg me.
PRO: It's what you'll end up using.
Source: Learn you Func Prog on five minute quick! [theregister.co.uk]
Re: (Score:3)
I've coded in node.js for a couple of years now, written some semi-big pieces of software to do real-time message passing/transaction processing stuff. It was fine. It's better than PHP, which I moved from. It's better than writing cgi-bin programs in C++, which is how I started. On of the big reasons to use node.js is it nicely integrates alternative protocols like WebSockets, RTC, AMPQ, so you can roll up a "web server plus other protocol" system that gets a lot of jobs done you just can't accomplish with PHP/Apache.
Well that's not really a big selling point. In the last couple of years I've worked on Java and Python projects that used WebSockets, RTC, AMQP, NoSQL databases, etc. Not only are these protocols well supported but in both cases you get a much richer and more robust platform to work on.
People love to hate on Javascript because they don't like admitting the language wars are over, and Javascript won. When you can walk into a room and ask "How many people have a compiler on them _right now_." and people answer "I've got at least two!" Try that with any other language. Compilers shipped, lines written, active users... JS wins on all metrics. It's not the "best" language, but then, what is?
And this is frankly misleading. Yes there's lots of Javascript code around, bit it's primarily on the client side. One of the biggest issues I've seen with node.js is the number of people who have only ever coded Javascrip
Re: (Score:2)
The call to have horribly nested callbacks is mitigated to some degree, but it's still ugly compared to approaches in other languages. It's still a callback driven paradigm, just allowing a somewhat less painful way to manage complex scenarios.
It's a lot like the other improvements in Javascript, significantly crippled by being worked to fit into the existing language.
Re: (Score:3)
I don't know if aspiring to PHP levels of maintainability/readability is a high ambition. Also, when the question is 'should I migrate from php', a sentiment that suggests 'about as good as php' doesn't seem to be a ringing endorsement.
Re: (Score:2)
Re:Works fine (Score:5, Interesting)
All truth passes through three stages. First, it is ridiculed. Second, it is violently opposed. Third, it is accepted as being self-evident.
— Arthur Schopenhauer, German philosopher (1788 – 1860)
I can second that it works fine. I'll go further to say it doesn't just work well, it works!!! Sadly though, it does take a better programmer to excel in JS/NodeJS.
1) Yes, it's asynchronous and takes some getting used to. But so are real CPUs, or perhaps you didn't notice because of all the language abstraction.
2) Yes, it's loosely typed. But try passing an actual function as a parameter in a strongly typed language. Or get a function back as a return value. Better yet, get back a runtime specialized function as a return value.
3) Yes, it's single threaded. And what a God Send that is. You can have the net effect of threading libraries with thread/variable synchronization without any of the overhead. (If you learn how to program in an async environment. Which seems to be hard for some people.)
4) Yes, NodeJS uses callbacks. So learn Promises. You avoid callback hell and get extra cool features, like queueing Promises. (Oh, right. Promises are hard.) :-)
5) Forget about OO polymorphism. JS take polymorphism to a level that Java/PHP can't even dream about. What you need Java Aspects for is natively baked into JS. And it did that on day one, not seven generations later or with an addon. JS is a natural at Aspect Programming (as well as Functional Programming.) Which makes life simple to go from prototype to fully featured. Especially when you find out about "features" the week before deployment. (Hint: it's this feature that make integration testing easy.)
6) NodeJS along with PM2, gives you the advantages of Docker Containers without the complexity or overheard or wasted disk space (or the need for tooling.) And it doesn't have to run in privledged mode. Which is only important if you think security is important. :-) You can break down your API into single endpoints (or groups of endponts) and run them seperately in their own execution context. Change, replace, update, deploy services without downtime or affecting other services on the same NodeJS instance. THIS IS Micro Services!
7) NodeJS's module system let's you run several versions of the same package but only in the dependency tree where they're needed. Think of running several Java6 libraries in the same JVM execution context as several Java8 libraries, at the same time, with no possible conflicts. Blow your mind yet?
I could go on, but that's not the point I'm trying to make.
First they laughed that JS was a "toy" language. Now they're opposing it as a new platform. So when will it be seen as self-evident?
Re: (Score:3)
Look back on the hype cycle of MongoDB and NoSQL: it was all the rage three years ago, now it's a fountain of regret. The same will happen with Node.
Re: (Score:3)
I gotta remember that one. Seems to be a apropos description of several projects at work.
Re: (Score:3)
Yes, it's loosely typed. But try passing an actual function as a parameter in a strongly typed language. Or get a function back as a return value. Better yet, get back a runtime specialized function as a return value.
Yeah. I think most strongly typed languages can do that perfectly fine. C++11, for instance, does it pretty well.
Re: (Score:3)
As a sysadmin (devops?), I don't have anything against the language per-se, but so far, I haven't been impressed with the packaging and deployment options. Maybe I'm not doing it right (quite possibly), but so far I'm not especially impressed with npm and pm2. I find they're both a bit opaque and don't feel very natural to me - I don't feel like I have proper control over them - it feels like they're doing 'clever' things on my behalf which I'd rather do myself.
None of that is a reason to avoid node.js, but
Re: (Score:2)
Haters gonna hate, but well-written JS performs better than most php software.
I doubt anyone would dispute that, but surely that's an abusrdly low bar.
I did some node.js for a while. The more I used it, the more I realised that what I really wanted was Erlang. All of the advantages of asynchronous events, plus real concurrency, real thread isolation, real stack backtraces...
Re: Node.js web scalable! Very funny (Score:2)
It is badass rockstar man too! [youtu.be]