Ask HN: PHP vs. Node.js vs. Go for a new startup?
Both my partner and I have good knowledge of PHP. However, due to the complexity of the project, we will have to find additional developers anyway. From what I read online Node.js and Go are the in thing right now, and scale much better than PHP. My question is, should we stick with the “Devil we know,” PHP, or dive into learning and developing in Node.js or Go. Should we consider another programing language / platform?
What are your thoughts. This are honest questions, we are just looking for some feedback. Thank you for your help.
[+] [-] pcwalton|12 years ago|reply
Even if the differences between node.js and Go mattered, you won't get anything valuable from asking HN "should I use node.js or Go", since the two stacks are broadly in a similar niche and have similarly-sized communities. It'll mostly be fans of one technology bashing the other, as you can already see in this thread. It would be better to focus on specific concerns: Do you need support for shared memory on multicore? Is the ability to reuse JavaScript code on the browser and the server a concern? Is there a specific library that's essential to your business that's only available on one or the other? These questions would engender a much more interesting discussion.
[+] [-] noodle|12 years ago|reply
New languages and frameworks have their pitfalls. Pick what you know so that you don't get tangled up in the weeds while trying to build out a product quickly.
[+] [-] pusewicz|12 years ago|reply
You should always be choosing something you are familiar with, because it will allow you to get where you want much quicker. And yes, later, then you do actually build a business, you can start playing around with newer technologies. But only if they are valuable for the business.
[+] [-] troels|12 years ago|reply
[+] [-] tjholowaychuk|12 years ago|reply
[+] [-] nostrademons|12 years ago|reply
The biggest question in your business model is not "How do I scale this?" or even "What technology should I use?", but "Will this take off?" If the answer to that is yes, you will have resources to deal with the problems of how to scale it, and you will have more information to answer the question of what technology to use. (In particular, you'll know what your developers want to use; you can give them an ownership stake in the technology decision - which should really be their decision, not yours; you will know exactly what feature set you need to implement and what sort of loads you'll bear; and additional libraries or technologies may have come out in the meantime.)
Usually the biggest factor in development time is how well you know the technologies you're using, not any intrinsic level of productivity with the tools. Different technologies will top out at different levels, and IMHO Go tops out significantly higher than Node.js, which tops out significantly higher than PHP (and at least in the early stages, Python tops out higher than Go). But if your goal is to found a successful company and you know what idea you want to pursue, you are better off investing the time in proving out your business idea than in learning the perfect new technology. (If you don't have a concrete idea, investing in learning a new technology is a pretty good way to pass the time until you do.)
[+] [-] ubersoldat2k7|12 years ago|reply
[+] [-] sambeau|12 years ago|reply
I started out writing CGIs and servers in C many years ago and have experimented with Perl, Python, PHP, Ruby, NodeJS and Go since then.
Go has a syntax that is instantly familiar and simple to master. Go's concurrency paradigms are simple to understand and easy to use. Go's compiler is fast and clear. If a Go program compiles it nearly always runs. Go's built-in library has most things you need to write HTTP-based servers.
If you use Go naively you will almost certainly be using Go correctly: your server will be fast and efficient. This is not the case with NodeJS. Writing fast, efficient NodeJS code is hard. Maintaining fast, efficient NodeJS code is even harder.
On the down side - while Go don't suffer from 'callback hell' but it does have a tendency towards 'cast soup' - this makes working with JSON a little trickier than it should.
Aside from the main programming language I would also look at:
* JSON API-first driven development
* Redis
* NodeJS's plethora of web-centric code management tools & compilers: SCSS, RequireJS, Grunt etc
* Single-page javascript App technology: Ember, Angular etc
* Docker.io
* SVG
* Camlistore
These (with Go) are the main technologies I'd use to build a large web infrastructure.
[+] [-] Jormundir|12 years ago|reply
I've heard good things about the mongodb package and interface, but I haven't had a reason to use mongo.
So really if you use Go for your server side, you'll get a lot of nice benefits, listed by sambeau, but just be aware, you might have to tussle to find the right fit of backend tools, and you will likely have to make your own Model abstraction. This might not be a downside though, as I know a lot of engineers will build (or rebuild) the model layer no matter the framework.
[+] [-] robinduckett|12 years ago|reply
Or how about a class which you pass methods to your callback functions and bind them to the instance properly.
You never need to nest a callback if you know how to work with prototypical inheritance.
[+] [-] mschuster91|12 years ago|reply
[+] [-] Goranek|12 years ago|reply
When time comes, you can always optimize it(writing performance critical parts in c), or pay guys who are better than you to "translate" your app to another language.
God knows i'm not following this advice, but please do not fall into a "premature optimization" trap.
[+] [-] ianhawes|12 years ago|reply
You want to start with something you know, especially at a time when getting an MVP, making iterations, and being nimble is important. Because you both already know PHP, this is a no-brainer. Things have changed dramatically with every aspect of web development in the past 6 years, and PHP is the thing that (although its changed a lot) has probably changed the least compared to your web front-end (HTML5/CSS3), client-side JS, and responsive design (which basically didn't exist 6 years ago).
You should also consider the economics of your situation. Developers who know enough about Go and Node.js to do it professionally are going to charge you much more than those who code PHP professionally.
Ultimately, you're probably doomed to failure just by raising this question. Its been stated ad nauseam on HN before, but you need to iterate quickly and discover what works and drives traffic/sales. Don't waste time trying to learn a new programming language. If you want to devote any time to learning something new, it should be learning how to market your product better.
[+] [-] adambard|12 years ago|reply
http://www.techempower.com/benchmarks/#section=data-r7&hw=ec...
I've got no love for PHP, but if you must, use a recent version and a decent framework.
[+] [-] aric|12 years ago|reply
http://www.techempower.com/benchmarks/#section=data-r7
[+] [-] sixdimensional|12 years ago|reply
[+] [-] bjourne|12 years ago|reply
My point is that that kind of traffic is truly minuscule. As long as you set it up correctly and use a decent cache it will handle the load fine. Any platform you choose and hosting for ~$200/month will be enough.
[+] [-] krisajenkins|12 years ago|reply
[+] [-] almosnow|12 years ago|reply
[+] [-] spamizbad|12 years ago|reply
Also, something as read-heavy as a blog is well suited for something like Varnish (https://www.varnish-cache.org/). Regardless of the backend technology you choose, a caching http proxy (or whatever) should be absorbing most of the traffic.
[+] [-] LocalMan|12 years ago|reply
But you might find coming up to date on PHP easier, since you already know an old version of it.
There are many more coders available for PHP than Go. But Go programmers on average are higher in quality because the drudges and blubs don't bother learning new languages.
Recently one of my hosting providers sent me a notice that my account was being transitioned to a new version of PHP. That can't happen with a compiled language like Go, since the none of the language itself goes up on the website, only the executable program binary.
I don't know much about Node.js...
[+] [-] x0054|12 years ago|reply
[+] [-] angularly|12 years ago|reply
I am currently switching to Go from PHP. It's really not that hard to learn once you get your head around the static types and lack of OO - last thing is a big plus in my book. The way they handle it with structs and interfaces are so much better.
Biggest problem is there are limited ressources on the net about Go, and the documentation is lacking compared to PHP, examples are sparse. So be warned it will take you some time to learn.
But it's such a beautiful and simple language, that will be a breeze to support in the future for you and your team. Debugging and maintainability is top knotch.
And much faster than PHP. Node.js is also fast, but well it's not as maintainable, javascript is a pretty messy language. My thoughts on the matter is described well here:
http://umugenzi.wordpress.com/2013/09/06/node-js-vs-go/
For the frontend i recommend AngularJS
[+] [-] okpatil|12 years ago|reply
[+] [-] nashadelic|12 years ago|reply
If you think you have the time and resources, and more importantly, if an interesting technology is part of the reason why you wanted to do a startup; then take the numerous technical advice given by others here.
[+] [-] davidkuridza|12 years ago|reply
The only reason I see you might want to go with Node or Go is if you want to attract developers who like to work with latest technologies. If you want to do the first version yourself, then choose the one you are most comfortable with. When you need to scale (from technical and resource perspective), make sure to analyse all aspects of it before going into one direction.
[+] [-] jtreminio|12 years ago|reply
PHP can easily take 1m/day.
[+] [-] fein|12 years ago|reply
[+] [-] gopalv|12 years ago|reply
I've found that the really important bit when writing read-heavy web-apps is good caching. The write-path could be written in something slow-ish and it will be hit far less than the front-caches serving data.
So, if you need a web templating language + basic json callbacks, php will definitely do the trick for version 1.0 (or ruby-on-rails or whatever gets you up to 100% feature complete). I've written game backends which did ~2.5k-3k rps on a single machine with PHP (though, I did have to fix PHP APC's locks to handle those loads in the process).
But then you still need to know JS to write the frontend code.
Node.js basically lets you combine 2 skill sets into one - the frontend and backend can share the same data model code for instance. This is easy if you have complex data-structures to communicate between the two layers.
Go actually gives up that advantage, but wins out because it can do compute intensive tasks faster - and can do state-ful daemons in a much nicer way. If you were building say, an online game, where say it was poker game with low-latencies, I would go for go. Definitely.
But as it stands, the only reason to go for Node.js is that your front-end dev can double as a backend-dev. Otherwise, I'd stick with what you know & are most productive in.
[+] [-] zaius|12 years ago|reply
Worry about scaling problems when you hit them, not when you're picking a language. For comparison, I serve 100k users per day using rails/Postgres on a single $80/month linode server.
[+] [-] talonx|12 years ago|reply
[+] [-] robinduckett|12 years ago|reply
Why node?
Node is a great framework for building web applications. It's got good support for scalable servers using Amazon Opsworks, nodejitsu, heroku, etc.
Javascript developers are easy to find, and even with no Node experience, any developer worth their salt can get up to speed pretty quickly.
Front-end and back-end can be written in the same language.
You can build rapidly and get to an MVP very quickly, at which point you can either switch to an enterprise language like Java (ugh) or Go, or whatever else to leverage performance, or scale your existing Node codebase using modules such as cluster, or by developing simple strategies on multiple servers.
I have built every kind of applicaton you can think of using Node, from desktop apps using node-webkit, to simple TCP video streaming servers using the built in networking and piping data directly into ffmpeg.
Testing and test driven development is natural in node, and you can write your server tests and browser tests in the same framework using mocha and phantomjs. I've even been building integration tests and automated UI tests using node, mocha and pahntomjs.
Our latest concurrent benchmarks for a load balanced group of t1 micros on a single mongodb instance get to at least 30k concurrent requests a second before you get a few timeouts, but that's just because i'm not too familiar with ops and haven't done any proper optimisation yet.
There is no right answer to this quest, but the above is my personal and professional opinion.
[+] [-] jbeja|12 years ago|reply
A Javascript developer that have been using it for client-side purpose will not learn how to use nodejs from the day to night even if he is a expert on it, for something nodejs is for serverside programing.
"Front-end and back-end can be written in the same language.". I would prefer to right my backend in something else instead Javscript , even PHP would be a more pleasant choice, and if that would be the case i would rather use Clojure and Clojurescript togather to right everything in the same language.
[+] [-] mattdawson|12 years ago|reply
FTFY.
In all seriousness, though, I'm the lead developer on a web applications team at a medium-sized client services company and my experience has been that competent JavaScript developers are among the hardest kind of developer to find right now.
[+] [-] Killswitch|12 years ago|reply
If you want to build it quickly, do it in what you know best... If you want to learn a new language as you go, build it in Node.js or Go.