by thatcodingdude · 6y ago · 0 comments
With a PHP background such as yours, I'd very strongly suggest Go over Rust. You'll pick up Go very easily (far faster than Rust, which has a high learning curve), Go jobs pay as well as Rust, it's in high demand, and it's going to remain in high demand for a long time. Most people can become productive in Go the first week they start learning it. Go lends itself to a webdev orientation far better than Rust; Rust is very weak in the webdev arena, you'll be endlessly frustrated by that fact.
My background is 25 or so years of webdev experience, with an early background in Java, Perl, ColdFusion and I've been using PHP since 2005 or thereabouts (I use it for CRUD work). Over time I added Python and then Go. I was able to be productive in Go immediately, and you'll find similar stories all over the Web. It's mostly a delight to learn.
I've also been handling nearly every aspect of the backend infrastructure for two decades now (servers, cache, security, database, etc), and Go is also very nice to deploy. It's dead simple and lightning fast for most things.
One side note, if you don't have much experience building APIs, I would put some focus there in tandem with Go. Being good at building and deploying APIs is a valuable skillset to have. I regularly use Go for such services and it performs like a champ.
Out of curiosity, what's the appeal of learning Rust ? What kind of projects do you use it for ?
I find that I can solve mostly everything with a blend of PHP/JS, but I also never escaped web CRUDy stuff, and PHP is very well suited for these.
Personally I would say learn it because it's one of those languages that changes how you think about programming as a whole and learning it will make you a better programmer in every language.
That said, I think Rust shows the most promise in a few places:
1. Pretty much anywhere you'd historically use C or C++.
2. WASM
Because Rust can expose C style FFIs you can use it to speed up hot code paths in almost all scripting languages(Python, Ruby, PHP, JS etc). This can be very useful because it allows you to keep most of your code in the scripting language that you and your collaborators are familiar with, while benefiting from Rust's strengths too.
For WASM I think Rust is currently the best choice, it has excellent tooling to work with the web, it's by far the most approachable suitable language for someone who already knows JS, and it doesn't have a big runtime or GC which makes many languages non-starters for the WASM usecase.
Some people would tell you it's a good choice for general purpose backend and there is an ecosystem around that, but I would say if that is your goal Rust offers nothing that Go doesn't do better or at least as well.
It has some nice features. Personally I never found myself besotted with it, in fact I rather dislike it and suggest ada instead. But rust is much more likely to get you a job.
Still playing with it for funsies, though.