3 ms·
I suspect this is about experience. I had experience with PHP, JavaScript, and Python, but when at first coding in Go it would take me as much as 10x as long.
by yboris 3y ago
I suspect this is about experience.
I had experience with PHP, JavaScript, and Python, but when at first coding in Go it would take me as much as 10x as long. But with more practice it's now only about 2x as long as in other languages. Keep practicing ;)
- brabel 3y agoI think my experience is actually the problem. I don't have enough patience anymore to spend lots of time trying to understand errors where I have zero idea why it's complaining, when I know the same thing in another language works totally fine the first time I try (and without bugs, it's mostly lifetime issues or the lovely borrow checker, which don't even exist in other languages). But I do keep trying Rust, because the alternatives as I see it, C and Zig, have their own problems that are bigger (C's build tools and lack of package management, very weak type checking and unavoidable UB, and Zig's overall lack of maturity and consequently tooling). By the way, I can write code very easily in Java/Kotlin/Groovy/Dart/JS/TS/Go/Lisp.
- db48x 3y agoYea, that's a common complaint coming from other safe languages where the safety is accomplished by runtime features (such as garbage collection) instead of compile–time rules. I think that most programs should be written in easier languages than Rust, since most of the time the engineering cost of creating a system is higher than the cost of running it. You can rewrite it in Rust once your system is large enough that eliminating the garbage collector will save you a few million dollars a year. By then you’ll have a complete understanding of the requirements, and you won’t have to experiment to get it right. Use a language like Lisp, which is designed for easy and fast experimentation, to write the first version of your software.
- Turskarama 3y ago>most of the time the engineering cost of creating a system is higher than the cost of running it. And most of the time the cost of _maintaining_ the system is higher than the cost of creating it. This is where Rust truly excels, it makes it much harder to write any hard to find bugs.
- db48x 3y agoYes, I include maintenance in the cost of running the system. And I agree with you that a well–written Rust program usually has quite low maintenance costs. In principle you should be able to approach zero maintenance costs with any language, but writing your system in Rust generally means you have abandoned complexities like garbage collection. Garbage collection speeds up development by an order of magnitude or more, but at the cost of having to monitor the performance of the GC, tune it as loads change and computers get more and more memory but don’t get any faster at accessing it, etc, etc. Exceptions are another thing that speeds up development at the cost of maintenance down the road. You have to log the exceptions that are happening and monitor them to make sure that they are rare otherwise they’ll silently become more common over time as your program gets more complex. Meanwhile Rust’s explicit error handling really makes you think at every step about exactly what odd conditions your program might encounter. If you use Rust’s type system correctly, you can encode very specific information about exactly which errors are possible or impossible at every point in your system. It’s more work up front but it saves a huge amount of time down the road.
- kazinator 3y ago> You can rewrite it in Rust once your system is large enough that eliminating the garbage collector will save you a few million dollars a year. Never gonna happen.
- db48x 3y agoWhy do you say that? We’ve all read articles from Cloudflare and Microsoft and others about rewriting services in Rust once it becomes obvious how much money they can save, so we know that it does happen. I’ve seen it happen at much smaller companies as well.
- bombolo 3y agoIt would probably take several years to do a full rewrite of a complicated system, and there'd be subtle differences all over the place.
- db48x 3y agoThen you don’t have good enough documentation or tests, and you probably tried to rewrite too much. You should rewrite that portion of your code where the performance is most critical, because that’s where you will save the most money.
- bombolo 3y agoHave you even worked with a big complicated legacy system whose authors have all quit?
- db48x 3y agoYes. A good example would be Firefox. Mozilla is gradually replacing core components of Firefox with replacements written in Rust. It is not cheap to do this without causing regressions, but they have a great test suite and they know that it will save money in the long run. It increases performance, decreases memory usage, and most importantly it greatly reduces the defect rate. They’ll probably never bother to replace _all_ of the C++ code with Rust, because a lot of it works well or isn’t security–critical. They’ve been doing this since Rust 1.0, with measurable improvements in every release of the last few years.
- swader999 3y agoChatGPT has really helped me get over the impatience hurdle. I let it do all the tedious stuff like looking up error messages.
- estebank 3y ago> I don't have enough patience anymore to spend lots of time trying to understand errors where I have zero idea why it's complaining I consider those bugs. Please file tickets for that. The errors should provide enough context for an uncaffeinated developer to understand what went wrong.