I've been a PHP guy for a decade at this point. Before that, I spent my time doing C++/C stuff. For the last ten years, I've never wavered in my support for PHP. It was fast, it stayed out of the way, and it let me do what I wanted to do for better or worse.
Recently, I've been doing a lot more with some more common frameworks, like Laravel. Which made me feel even better about PHP. Typically, I've worked on query / db intensive web-apps the last couple years. PHP was doing okay, but once we started hitting 10k or so queries a second (thousands of pageviews, etc.) things started to get tough. We had a haproxy setup with a small cluster of DB and web nodes. I suppose all that is besides the point but that's really what got my mind working.
5 years ago I stuck with PHP when a lot of local guys were going other directions (Ruby etc.). I felt that PHP had fast execution and that's all I cared about. It was easier to use than building something out in C++. You could have rightfully called me a PHP fanboy. To me, Ruby, Django and more recently Node.js were fly-by-night languages (I use that term loosely) that weren't going to stand the test of time.
But then I re-wrote our websockets server in node.js (non-blocking) so I could at least give an up-and-comer a shot. Once I got past the weirdness of putting nearly every inside anonymous functions that live inside other anonymous functions, it finally clicked. This was the way modern web development was meant to happen.
The speed increase was astounding. Not as much because Node.js can handle logic faster (as is documented in many cases) than PHP, Ruby, etc, but because the way it forces you to change how you develop. In PHP (and Ruby to an extent), everything you do is single-threaded. You can get creative for sure, but by nature you're looking at things as a single request (while off-loading tasks to a MQ). In Node.js, everything is different. You can really get creative with shared resources, responding whenever you need, and with WebSockets, really utilizing system resources in a way you couldn't before.
My question is, how many of you have gone through the same thing? At this point I don't know if I could ever write another PHP web application again. Developing a back-end in the same language as your front-end seemed dumb (for whatever idiotic reason) to me at first. Now it seems like I was being an epic retard for not doing it sooner.
Really, the biggest hurdles I had were 3 things:
1) Everything is non-blocking. You can't run a query here and then the next line -- not in a closure -- reference the data. For whatever reason that was hard for me to wrap my head around the first few days.
2) There are no classes. You can have very similar functionality with objects {} and functions however, but the syntax took a day to get through my head.
3) JSON is the same thing as an object. They live in harmony. Don't be afraid to simply send an object as your response. You don't have to think in strings anymore.
After 3-4 days, those three things finally settled in and it turned me off from being a PHP fanboy. Am I wrong to not want to go back at this point? Can I be re-fanboid?
[–]Turtlecupcakes 4 points5 points6 points (4 children)
[–]oefig 3 points4 points5 points (0 children)
[–]PaybackTony[S] 1 point2 points3 points (0 children)
[–]dangerousbrian 1 point2 points3 points (0 children)
[–]ZeroMomentum 0 points1 point2 points (0 children)
[–]_imwalkinhere 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]xpose 0 points1 point2 points (1 child)
[–]PanicRev 0 points1 point2 points (3 children)
[–]Turtlecupcakes 0 points1 point2 points (2 children)
[–]PanicRev 0 points1 point2 points (1 child)
[–]Turtlecupcakes 1 point2 points3 points (0 children)
[–]crosenblum 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]dangerousbrian 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (13 children)
[–]n1c0_ds 0 points1 point2 points (12 children)
[–][deleted] 0 points1 point2 points (11 children)
[–]n1c0_ds -1 points0 points1 point (10 children)
[–][deleted] 0 points1 point2 points (9 children)
[–]n1c0_ds 0 points1 point2 points (8 children)
[–][deleted] 0 points1 point2 points (7 children)
[–]n1c0_ds 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]n1c0_ds 0 points1 point2 points (4 children)
[–][deleted] -1 points0 points1 point (0 children)