Ask HN: Moving Beyond PHP for the Problem Solving Programmer
I am a single programmer in a small business that currently uses PHP (w/ PDO) to (mostly) read from MySQL and MSSQL databases and output HTML/JS.
PHP is easy for me and I can write good, fast code. I start to hate the language when I use external code or frameworks. If there was a 'one right' way to do PHP, I'd be fine.
Over the past year, I've been toying with the idea of moving to Python, Go, or NodeJS. Each has their plusses and minuses, and I am paralyzed in making my decision.
I am just one guy, trying to solve problems. I understand the 'right tool for the job' philosophy, but each of us has that one particular screwdriver we REALLY like to use. Imagine yourself as that rep in Lowe's and please share with me what you would choose if you were in my shoes and why.
4 comments
[ 8.0 ms ] story [ 21.3 ms ] threadPython - GIL seems like a big deal for future concerns and Python 3 doesn't seem that much 'cleaner' to write than Golang.
Go - Really new, virtually everything available on Github is still alpha (e.g. Revel). Plus, is it really meant to be a CRUD-like web language?
NodeJS - Javascript everywhere would be nice if I never had to go back and modify my code, ever. Just really tough to grok after I've been away from something I wrote in the past.
PHP is the language allowing to craft something quick and crappy and making "it" to work on any platform it is easy to get lazy with this.
I found myself I stopped growing with PHP.
Quickie, interpreted languages for "hit and run" projects are not my stuff. Spiritually it is not mine.
I used to do lots of high performance, multithreaded, backend apps coding in C++ before. So I decided to switch to .NET / C# platform. Love it. It's secure, it's fast, it's enterprise supported, it's has the best development and deployment tools on the market, it's fully cloud ready. It's strongly typed (no RoR junk like: "cat ran on my keyword and I successfully deployed it to production" any more).
It's convoluted, it's overly complicated and it more and more poorly documented but I having fun with it. It gets the job done.
The main reason I enjoy it is that it forces me to think about problems in a different way than I'm used to. Rust is a typed language (with some type inference going on), and it doesn't really have arrays like PHP does, so it's a real challenge to solve problems in it.
For instance, I've been going through Rosetta Code (http://www.rosettacode.org) and trying to implement anything that sounds interesting in Rust. So far, I've done levenshtein (built into PHP), lzw compression, fibonacci sequence, MD5 hashing (built into PHP), quick sort, bubble sort, binary search, binary trees, etc. It's a lot of reinventing the wheel, but it's made me think about programming differently.
An example of a real-world result is that in my day job, I have an app that processes 10,000 items in 5 minutes. It takes that long for various reasons, but I decided to re-implement it in Rust. Using the exact same algorithm, Rust completed the task in 60 seconds -- that's 5x faster! But while I was working on it in Rust, I realized that I was doing some things inefficiently, so I reworked the algorithm in Rust. Once I completed that, the entire task took 250ms (!!!). I decided to port that algorithm to PHP, and my new version completed 10,000 items in 1.4 seconds.
Going from 312s down to 1.4s is a huge deal, and while the new algorithm doesn't solve all the edge cases that the old one does, it's good enough that I can use it and compensate for the differences later. I can process those 10,000 items in 1.4s, and then spend 30 seconds handling the 300 that the algorithm didn't catch.
Anyway, I digressed a bit, but I picked Rust, and I don't regret it. I suspect I would have had similar successes had I used C or C++ or Java, too.