PHP in a JavaScript world
blonde.net
blonde.net
These are vastly popular, feature rich out of the box tools in PHP, aka the "killer apps".
As I don't follow the node community, what are the killer apps on the node side? Im talking about a complete piece of software, where I would want to set up an environment not for development but for running an application.
I think >99% of the people who wanted a website (blog/forum/etc) had to call an IT guy to get this running.
Now they just have to register for a SaaS and the most technical they have to do, is linking their domain to it.
Similarly, Rails made Ruby popular.
(I won't call phabricator a "vastly popular, feature rich out of the box tools")
"I will be honest. I use ghost as my blogging platform for about a year, and in comparison to wordpress... it just doesn't hold up. Everything from stuff as big as upgrading, mid range as plugins, and even simple things like spell check were overlooked (at least in the version I have). It kind of reminds me of the Pepsi Vs. Coke test. Went to it for that initial appeal of simplicity.. and now am very dissatisfied due to how much its lacking."
- Minification: Uglify
- Transpilation: Babel/TypeScript/CoffeeScript
- JS Module Systems: Require/Browserify/Webpack/JSPM
- CSS preprocessors: Less/Sass/Stylus
- Linting: JSHint/ESLint/CSSLint
If you're using a lot of front-end tools, you're using Node. And if you're using Node, you might as well use it to write your APIs.
At this time Javascript's biggest strength is build tools. It may not be as mature as PHP on the server, but there is so much community growth that I don't think it will be long catching up.
The fact that there's at least 4 "mainstream" build tools and their popularity changes every 6 months is a sign of an ecosystem with little stability that is no good to build a solid foundation.
On Ruby and Python land, how long has it been since RoR and Django have been the dominant players?
No, not when I have access to all kinds of other languages, frameworks, libraries, etc to choose from on the server side.
Cloud9 I guess would be a good example of a killer app ,but that's no CMS.
The reason why there is no serious CMS with node is that nodejs development is extremely hard, because async programming is hard. No matter how much layers one puts on top of it (promises,generators...) you can't abstract async programming in nodejs.
Look at Go, Go routines can be totally abstracted. IF I write that code:
result := Object.DoNonBlocking()
As a client of Object I don't have to know whether it is run concurrently, or not , or blocking or not. In node I have to know whether I returns a promise or a value , IE hump into the event loop or not.PHP has its share of problems though,just like Go, but their concurrency model(or lack of) make things way more easy.
I can't imagine writing something such as Magento or Drupal in nodejs (with the exact same features). It would be just insane. A great challenge though.
> Wordpress, drupal, magento, phabricator, mediawiki, sugarcrm...
Very few apps are built from scratch using PHP unless the intention is to share the application code like wordpress, drupal, etc.
On Node, you're almost always building from scratch, rather than creating plugins for an existing application.
Apples and oranges. Different use cases.
Yes, there are. I didn't say there weren't. I think PHP is great, relax.
In my professional experience, however, I don't see people start a codebase from scratch in PHP anymore. It's almost always based on Node.
Err.. that's exactly what you said, no?
Well, yeah, if you work in a shop where node is the goto solution on the server side, that's going to be your experience.
Unreal engine in asm.js <<< this would be a "killer app" for the platform as a whole.
There aren't any, really. Coupled with NPM it's great for building your own platform with custom requirements, but if you want to spin up an instance of something that already gets you 90% of the way there, PHP is a better choice.
I think the concurrency model provided by green threads in Go and Erlang is orders of magnitude easier to reason about, where you can write blocking I/O and the scheduler itself will take care of making sure that your code runs fine. The last thing I need when writing concurrent code is yet another thing to think about at every step of the way. This is a hugely underrated flaw in my opinion of node.js servers. With languages like Haskell, Rust, and Go we are seeing a trend of having smarter compilers and language runtimes making programs much easier to write, where I am offloading lots of things from my mind onto the compiler. The whole point of pre-emptive multi-tasking is to relieve the burden of "taking care not to block [the event loop]," and I think in that respect node.js is a step back.
Sure, I need to not BLOCK stuff for long, but that comes about somewhat naturally as good code: Write small, discrete units.
Not knowing modern multithreaded languages may render my entire point moot. I'll have to fix that.
Edit:// Also Digita Ocean $5 VPS is cheap to play with Node on, or even use a Vagrant machine.
Obviously I could pay for other hardware but I don't want to do that.
"It's easy, just install Node." funny.
Essentially you setup nginx to listen on port 80, Apache to listen on another port (say, 8080) and node to listen on a different port (say, 8081). Then have your nginx config differentiate between the two:
upstream apache {
server 127.0.0.1:8080;
}
upstream nodeapp {
server 127.0.0.1:8081;
}
server {
listen 80;
server_name myphpapp.example.com;
location / {
proxy_pass http://apache;
proxy_set_header Host $host;
}
}
server {
listen 80;
server_name mynodeapp.example.com;
location / {
proxy_pass http://nodeapp;
proxy_set_header Host $host;
}
}
IMO this gets a little easier to think about if you substitute your Apache -(mod_php)-> PHP setup for Nginx -(fastcgi)-> php-fpm - handing off to an appserver rather than a webserver.I've considered reverse-proxying entirely within Apache to avoid adding ngnix another layer. But this really hinders some of the advantages of node which makes me wonder if it's worth even doing. It seems like node is best when it can handle the requests directly.
Your advice here is pretty much the most common answer.
What makes you believe that?
https://www.youtube.com/watch?v=p3gMSnaZrp8&feature=youtu.be
At the end of the day, all of the languages being discussed here are all capable of achieving the same goals for 99% of the problems presented. Every language has its pros/cons and brings something new to the table that we usually see the others adopt.
or server-side as in... cgi/fastcgi serving to a client?
because I would say 'yes' to cgi/fastcgi, but 'no' to shell scripts/daemons.
There are a handful of really cool newish Perl frameworks, but unfortunately I think Perl 5's stigma is so far out there it will never gain any real traction. It seems that Perl 6 has a lot of the same stigma attached to it. I almost wish they would name it something other than Perl so that a fresh perspective could be used, it seems like it's going to be quite nice!
Figure: http://imgur.com/NnQ9M5v
[1] http://link.springer.com/article/10.1007/s00607-014-0394-9 "Is Node.js a viable option for building modern web applications? A performance evaluation study"
Personally I like these working arrangements and being able to dish up HTML safe in the knowledge that your frontend developer is getting what he needs complete with expected class tags and other markup to be styled. In the future it will probably be better for me as I won't be doing template files with fiddly PHP tags, instead I will be json encoding the requested data, e.g. an array of products. There is a whole lot of logic to getting that array of products, this you need the server for. Presentation of that data? That can be done with the new stuff. From this article I have a better idea of what might be the future.