News for hackers. Stuff that matters.
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by tyingq on Tuesday May 16, 2017 @09:37AM (#14349428)
"The app itself is powered by Laravel, Vue.js, Socket.io, and Node"

Is there another Laravel other than the php one? Seems odd to roll out with both php and node.js. I don't know why you would need both.

Edit: Yes, I see each has it's strengths. But that has to drive a lot of doing the same thing twice, in two languages...they both interact with the same data. I would guess time-to-market is important at launch to react to things you missed. I would have settled on one or the other. Feels like premature optimization.

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by mediumdeviation on Tuesday May 16, 2017 @09:42AM (#14349473)
Laravel 5.4 integrates with Vue. https://laravel.com/docs/5.4/frontend#writing-vue-components

Laravel can act as the API backend to the frontend (basically a set of REST endpoints that the frontend can talk to), or alternatively the Vue components are used only where heavy client-side interactions are required, while the rest of the pages are still served up by Laravel normally.

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by seibelj on Tuesday May 16, 2017 @10:18AM (#14349747)
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
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by tyingq on Tuesday May 16, 2017 @10:21AM (#14349769)
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.

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by seibelj on Tuesday May 16, 2017 @10:26AM (#14349809)
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.
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by tyingq on Tuesday May 16, 2017 @10:30AM (#14349835)
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.

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by seibelj on Tuesday May 16, 2017 @10:33AM (#14349853)
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.
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by dvorwak on Tuesday May 16, 2017 @10:36AM (#14349884)
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.
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by codegeek on Tuesday May 16, 2017 @11:38AM (#14350383)
I have played around a bit with socket.io and the reason you use Node for it is that socket.io itself comes with a in built node server for backend. So it is much easier and faster to fire up a server to run socket.io using node.
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by tyingq on Tuesday May 16, 2017 @12:02PM (#14350628)
Sure. Why would you though, not use node.js for the rest of the site? I'm not complaining about either php or node.js. I'm complaining about using both of them for a brand new site.

I assume that both would need to understand the concepts around: users, admins, moderators, topic areas, topics, threads, banning, moderating, vote counts, sessions, and so forth. And interacting with all of that both server<->browser and server<->database. Feels like a lot of duplicated classes, marshalling, etc.

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by rprime on Tuesday May 16, 2017 @09:39AM (#14349445)
I assume NodeJS is used just as a WebSocket server for their real-time events, doing that in PHP would be a bit uncomfortable.
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by icebraining on Tuesday May 16, 2017 @09:53AM (#14349565)
doing that in PHP would be a bit uncomfortable.

Why? PHP works fine as a daemon, there are many servers written in pure PHP, as well as frameworks for "async" programming.

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by Shorel on Tuesday May 16, 2017 @11:08AM (#14350165)
It is uncomfortable, sadly. At the very least PHP Ratchet is not quite integrated with Laravel and the easy route is to use Node.

https://github.com/laravel/echo

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by rprime on Thursday May 18, 2017 @06:30PM (#14371614)
I am not saying that as an attack to PHP (or a defense of NodeJS), I am writing PHP daily, but when it comes to real-time (at least WS systems), PHP would be my last resort, mostly because it lacks any real support for such things, you'll have to force your way in.

I guess we come back to _just because you can doesn't mean you should_. :)

Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by emodendroket on Tuesday May 16, 2017 @09:39AM (#14349444)
It seems like if it's real-time a lot of the page is dynamic applications you interact with through AJAX, and probably it was easier to do that and get acceptable performance in Node. The other functions (say, edit profile) could then be handled by Laravel more easily. At least that's what I'd guess.
Re:Voten.co, a Real-Time Reddit Alternative Launches Public ... by dvdhnt on Tuesday May 16, 2017 @10:12AM (#14349696)
Agreed. Also, I've never noticed someone using both a front-end framework AND jQuery simultaneously. Usually, at least in projects I've collaborated on, this is redundant. However, I've never used Vue.js, so perhaps this is standard?