To the Node and Back

I spent a couple of weeks porting Gastropoda from PHP to Node.js after caving in to peer pressure and hearing “PHP sucks” from every side imaginable.

And yes, I know - Why would you go from PHP to JS? Screw JS! Boo!

I like JavaScript. All of my hobby project save Time to Die have been made in JavaScript. And even JS doesn’t seem to be quite as hated as PHP (not anymore, anyway).

So I finished most of the port (from PHP and MySQL to Node and MongoDB). It was ok. I mean, it was pretty quick and aside from a few mild detours it went pretty smoothly.

But as I was maybe 3/4 of the way to having an exact replica of the functionality of the PHP version I reflected and realized that I just wasn’t having very much fun. Gastropoda is a hobby project - who the crap cares if I use the “worst language in the world” to build it? I’m doing my best to build it the right way (as much as there is a right way with PHP), but it will never be perfect. The Node version would have never been perfect, either. I’m not sure why I didn’t enjoy it as much. Maybe it had something to do with reimplementing all the features that I had already done just a few weeks ago. And refactoring the JS version as I learned better Node practices, implementing promises, etc. The weird thing is I don’t even mind revising the PHP version as I learn better ways of doing things. It was only boring when I was using Node, and I can’t really explain why.

It’s really just as I got Bluebird working for promises that I decided that the process of developing the same exact simulation with Node just wasn’t as fun for me as it had been this whole time in PHP. You could argue that maybe I’ve gotten too comfortable with PHP and Node just had more of a hump that I had to get over, that maybe I got lazy and went back to the “easier” option, but I don’t know if that’s the case. After all, the very first draft of Gastropoda, when I built it for One Game a Month last year, was built using Node and Mongo. All of my other projects were JS. That was before I’d written a single PHP project. Gastropoda is the first PHP hobby project I’ve ever done and while I don’t hate using it as much as many people seem to I’m certainly not comfortable with it in any sense of the word. There is always something new to learn…some weird quirk or best practice that has me rewriting tons of work. It’s just that for some reason with PHP I don’t really mind doing all that.

Anyway, instead of spending any more time on the port I switched back to the PHP branch and implemented snail death. I’m not against trying out ports to other languages, but I have a feeling in the end I’ll keep coming back to PHP for this particular project. In the future I’d love to dig into Go, and maybe play around with Rust. Just…probably not for this. Ever since I first thought of the idea of Gastropoda (before it ever had that name, or any name), I had imagined it in PHP - just like the games I played when we got our first computer and a dial-up connection after moving to the US. And maybe for a hobby project that nostalgia is reason enough to stick with “a fractal of bad design”.

Comments