Hacker News new | ask | show | jobs
by seibelj 3321 days ago
Nothing wrong with PHP, just use the right tool for the job, and the right tool is based on existing skills, time to market, requirements, etc. If PHP fits the bill, use PHP
2 comments

That's not what I said though. I'm asking why php AND node.js. One or the other should suffice.

For websockets, as an example, HHVM+proxygen should be as performant as node. Or, node should be roughly as good as php for developer speed on the normal, not-websockets side of the house.

In a microservices architecture, you might have many languages. And if you have a PHP developer and a node.js dev, and you are trying to deliver as fast as possible, that could be a reason to split it up.
Writing everything twice for the speculative success of a brand new Reddit clone doesn't qualify as "deliver as fast as possible" to me.

Edit: For clarity, I mean there would be significant overlap in areas like data retrieval, sessions/auth, etc.

A Reddit like app would have read/write to and from the browser and to and from the database for many data structures. Users, admins, moderators, topic areas, topics, threads, users, etc. And different views depending on context. You see more of your own profile, less of others...and similar for moderated topic areas and so forth. So, 2 platforms means duplication of some of this data access, update, marshalling, acls, sessions, etc.

Assuming the node.js part is for the "real time posts", via websockets, it would need most of the above. Then, assuming php is handling the rest, including profile edit, rendering everything but the posts, etc...it also needs most of the above.

I seriously doubt they are cloning all of their features in 2 languages, I think they are just splitting up features into different tech stacks.
Probably just Laravel for their API and Node + Vue (if they aren't using laravel elixir for the frontend) so that they can more easily do server side rendering via express.