{"action":"closed","issue":{"url":"https://api.github.com/repos/spencersnygg/VoteWise/issues/14","labels_url":"https://api.github.com/repos/spencersnygg/VoteWise/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/spencersnygg/VoteWise/issues/14/comments","events_url":"https://api.github.com/repos/spencersnygg/VoteWise/issues/14/events","html_url":"https://github.com/spencersnygg/VoteWise/issues/14","id":101436184,"number":14,"title":"Should we switch from PHP to Node.JS or GOlang?  PLEASE REPLY ASAP","user":{"login":"spencersnygg","id":11878890,"avatar_url":"https://avatars.githubusercontent.com/u/11878890?v=3","gravatar_id":"","url":"https://api.github.com/users/spencersnygg","html_url":"https://github.com/spencersnygg","followers_url":"https://api.github.com/users/spencersnygg/followers","following_url":"https://api.github.com/users/spencersnygg/following{/other_user}","gists_url":"https://api.github.com/users/spencersnygg/gists{/gist_id}","starred_url":"https://api.github.com/users/spencersnygg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencersnygg/subscriptions","organizations_url":"https://api.github.com/users/spencersnygg/orgs","repos_url":"https://api.github.com/users/spencersnygg/repos","events_url":"https://api.github.com/users/spencersnygg/events{/privacy}","received_events_url":"https://api.github.com/users/spencersnygg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-08-17T14:39:54Z","updated_at":"2015-09-03T01:58:21Z","closed_at":"2015-09-03T01:58:21Z","body":"Alec, one of the programmers really wants to switch to GOlang.  \"GO\", also know as \"Golang\" or less common \"Google language\", appears to be a bit of a mash-up of Pascal and C++.  It is faster and can run concurrently instead of single stream.  It has been around for like 4 years and is very popular in China, but I'm not sure about the USA.\r\n\r\nAt this moment, I have an open mind since we haven't written any back-end code yet, other than the databases.  My biggest concern is that It's been a lot easier to find PHP guys, so if we switch out of PHP, and we lose the one guy we have who knows GO, we could be a bit screwed.  My understanding about Node is that, like much of Javascript, there are a million ways to skin a cat, so just because two people know Node, it doesn't mean that it's easy to figure out each other's code - making it harder to pass the baton from one part time volunteer to another.  But I could be wrong on this.\r\n\r\nWhatever we go with, the decision has to be made pronto because we are really close to our deadline of Oct 1st.\r\n\r\nAlec is a proponent of GO and I will let him explain the differences as he sees them:\r\n\r\n\"I've used PHP, Node.js, and Go in production webserver, so I'll give my\r\nanalysis on the pros/cons of each that could spur discussion.\r\n\r\nPHP Pros\r\n\r\n   - Pretty well known.  This has a potential downside in that it's the\r\n   kind of language where, even if a lot of people know it, a higher\r\n   percentage of PHP programmers are less competent, since it's such a common\r\n   entry level language.  Not something that concerns me though.\r\n   - Development cycle is easy.  Change code, refresh.\r\n   - With HHVM we could also integrate Hack code with the rest of the PHP\r\n   seamlessly, which is a type variant of PHP made by Facebook.  I don't know\r\n   how well supported this is yet though.\r\n   - Used effectively in production by several companies; Facebook is the\r\n   best example.  Although they seem to be trying to move away from PHP as\r\n   much as they can (like HHVM and Hack; also a lot of their code is C++\r\n   nowadays).\r\n\r\nPHP Cons\r\n\r\n   - Slow.  Even HHVM is slower than Node/Go.\r\n   http://dan.hersam.com/2015/02/25/go-vs-node-vs-php-vs-hhvm-and-wordpress-benchmarks/\r\n   compares Go, Node, PHP, and PHP via HHVM.  This is partly because resources\r\n   like database connections have to be reloaded every time a page is\r\n   requested.\r\n   - Standard library is poorly designed/buggy.  This is a common topic for\r\n   PHP developers.  See https://www.reddit.com/r/lolphp/top/?sort=top&t=all\r\n   for examples.  At Balihoo there was generally a lot of complaints in this\r\n   regard.\r\n   - Implicit typecasting and default settings are known to introduce\r\n   security bugs/weird issues.\r\n   - Lack of static typing in general doesn't work well for big projects.\r\n   - No parallelism except per-request.  Meaning if we're doing I/O in a\r\n   single request/response (like accessing the database), we can only do one\r\n   database request/filesystem access at a time even when we could be doing\r\n   multiple at the same time.  Not a big deal though.\r\n\r\nPlus I'm concerned about the troubles we had setting up homestead; it was\r\nsupposed to make development easier, not harder to set up.  Although this\r\nis not necessarily an issue with Laravel or PHP itself.  If we continue\r\nhaving trouble with Homestead I'd probably prefer to forego it and develop\r\nPHP directly without a VM.\r\n\r\nThe VM also consumed a fair amount of resources on my computer (it was\r\neating up 30% CPU at one point, not sure why), so I'd *prefer* being able\r\nto develop in my normal environment.\r\n\r\nNode.js Pros\r\n\r\n   - Javascript is very well known.  Better than PHP even.  Front-end\r\n   developers would automatically know the language for the back end.\r\n   - Used effectively in production.  Examples of companies that use it\r\n   include Netflix, New York Time, Paypal, Medium, LinkedIn, Groupon.\r\n      - https://www.quora.com/What-companies-are-using-Node-js-in-production\r\n      - Same language on front end and back end.  Can make it easier to\r\n   share code, although this isn't necessarily useful for our needs.\r\n   - We already have Node/NPM in our source tree for Gulp and such.\r\n   - Pretty quick.  Not as fast as Go, but a lot faster than PHP.  Can, to\r\n   an extent, take advantage of parallelism with I/O.  Not as well as Go\r\n   though, since Javascript only runs single threaded.\r\n   - I/O parallelism.  Better than PHP's per-request parallelism, but\r\n   unfortunately the entire server runs in a single thread, which can still be\r\n   wasteful and introduce unnecessary latency considering how many cores most\r\n   machines have.\r\n   - Better module system than PHP, especially with NPM.\r\n\r\nNode.js Cons\r\n\r\n   - Callback hell.  http://callbackhell.com/ for an example.  A downside\r\n   to Node.js's approach to concurrency.\r\n   - Lack of static typing can make large projects less manageable over\r\n   time.  Something I dealt with at Balihoo.\r\n\r\nGo Pros\r\n\r\n   - Fast.  Faster than the other two for sure.\r\n   - True parallelism is easy and avoids callback hell, so we can take full\r\n   advantage of our server's resources and keep latency manageable.\r\n   - Used effectively in production.  DropBox, CloudFlare, SoundCloud, and,\r\n   of course, Google.\r\n      -\r\n      https://www.quora.com/What-systems-in-production-are-written-in-Go-if-any\r\n      - https://blog.golang.org/go-at-io-frequently-asked-questions\r\n   - Statically typed.  Much easier to keep a big project manageable.\r\n   - Well designed standard library.  From personal experience, from best\r\n   to worst standard libraries, I'd say: Go, Node.js, PHP.\r\n   - Syntax/code is easy to learn and understand.  More self-explanatory\r\n   than Node or PHP in my opinion.\r\n\r\nGo cons\r\n\r\n   - Less well known than Node.js at least, I'm not sure what kind of\r\n   userbase it has.  It's well known in the circles I frequent (Balihoo was\r\n   considering it for production), but not as many actually knew it.  The\r\n   community is certainly productive at least, I've never hard a problem\r\n   finding a library for something.\r\n\r\nI'd be happy to answer any questions you have about comparing the three\r\nlanguages and their environments.  I want to choose a language that suits\r\nthe whole team and project best, and hopefully this information helps us\r\ndiscuss it.  I'd prefer Go over Node.js or PHP, but if it's not well known\r\nenough, then Node.js sounds like a solid choice.\r\n\r\nThanks,\r\n\r\nAlec\"\r\n\r\n"}}