Rust-Lang or Go?

Hello,
I have some questions about Rust-Lang:

1- Is Rust-Lang good for a beginner?

2- Can I use Rust-Lang for Blockchain and Web3 programming? Can you compare it with the Solidity programming language?

3- Rust is better for the cloud computing or Go? Please see "Rust vs. GO. My goal is to compare both languages… | by Javier Ramos | ITNEXT" .

4- Any big projects that are written in the Rust-Lang?

5- How about Android and web programming?

Please answer to my questions by number.

Thank you.

1 Like

You are asking on a Rust forum, so answers will likely be in favor of the language. That said:

  1. This is hard to give a general yes/no answer to. It depends who you ask. I have seen supposedly experienced programmers who struggled a lot with Rust. I have seen way less experienced/younger people handle it just fine as well. You can just… try it for yourself and see?
  2. To questions of the form "can I use Rust for writing X software", the answer is "yes". The question is whether you should. It turns out, Rust is used a lot in the blockchain industry, so you are lucky with that.
  3. "Cloud computing" is overly broad. What are you computing in the cloud? But again, I wouldn't expect many "no" reponses to this question… I personally prefer using Rust for back-end work nowadays because of its reliability, I think the ability to model business logic in the type system, have it compile to fast native executables, and have the ability to interact with FFI is great. I really don't see what you can accomplish with Go that you can't in Rust, and I don't find Rust difficult, so I don't sympathize with the "but go is easier to write" argument either.
  4. You can just Google this one. The elephant in the room is the build system/infrastructure itself (the Rust compiler, rustc; the Cargo build tool; Clippy; docs.rs and a lot more).
  5. I'm not sure what this question is about. Is the question "can you use Rust for Android or Web programming"? Is the question "are there any big projects written in Rust for Android"?
4 Likes

It's a bit hard to answer this because I've been programming for a while now, but I think the fact that Rust makes programmers think about a lot of details up front instead of deferring them until later (when you've hopefully gained more experience) will make it a bit harder to learn.

Especially when you are still trying to figure out what variables and functions are.

A dynamically typed language like Python is usually a lot easier to start with.

Rust is the #1 most popular language for dealing with blockchain in the world.

It's gotten to the point that adding "Rust" to your LinkedIn is an almost guaranteed way to have crypto recruiters sending you messages every week or so.

Ehh...

Rust is really good when you care about details/correctness in your algorithms or high performance. References and lifetimes and slices give you a lot of control over your code, plus Rust's enums make it very easy to model different states in a way that you won't accidentally mess things up.

Go is really good for writing concurrent programs and rapid iteration, and it trades off a lot of control for nice things like garbage collection. The primary target for the language was web servers at companies like Google, so Go is pretty nice for anything that needs to interact with the web.

If we use cars as an analogy, I would say Rust is a Chevroet Corvette and Go is a Toyota Corolla. The Corolla isn't flashy, but it's your typical car that everyone understands and will get the job done okay. On the other hand, the Corvette is really nice to drive and really fast, but it also requires a better driver and more skilled mechanics to maintain it.

For me, Go feels a lot like the language you would use in a big company with armies of coders in cubicles, whereas Rust is the language used by a small team of geniuses at NASA.

I believe Rust powers a good chunk of Microft Azure and Amazon Web Services. It's also making its way into the Linux kernel, pluis Android's bluetooth stack and part of their security system (keystore 2.0) is written in Rust.

Discord also switched from Go to Rust in 2020.

2 Likes

Hello,
Any tutorial about Blockchain programming with Rust?

Thanks.

Googling "blockchain programming in Rust" showed loads of tutorials and articles about the topic. Maybe one of those will help you?

4 Likes

Thanks, but just find one book.
If Rust is number one in Blockchain programming, then why most of the books is about the Solidity and Python?

I don't think anyone claimed that.

Solidity is a smart contract language. It's a high-level abstraction over the low-level cryptographical details. It's not suited for implementing eg. the virtual machines themselves that smart contracts run on.

In contrast, the way Rust is used for blockchains is exactly the implementation of core infrastructure. I guess most people "interested in crypto" really just want to know how to churn out smart contracts like sausages in the hope of making big $$$, and they are much less interested in implementing a new platform from scratch, so that obviously affects the market of teaching materials.

8 Likes

Thank you.
The Solana and Polkadot written in Rust, then if anyone wants to write a DApp on these blockchain platforms, must know Rust?

Rust and Go have frequently-opposite philosophies, as far as languages go, so you should use the one that resonates better with what you personally value.

For example, if you really really care about "lines of code compiled per second", you want Go.

5 Likes

Hello,
I see many ideas about your question already above here.

  1. When I was first taught programming in tech school back in the mid-1970's we were introduced with BASIC but in the same year were expected to become familiar, even fluent, with assembler as well. A year later we were using ALGOL. As such I see no reason Rust could not be a suitable language to introduce programming to a complete beginner. However I feel it would take the creation of instruction materials for raw, even very young, beginners to be created. As far as I know such materials do not exist yet.

  2. Apparently so. See above.

  3. Rust. See below.

  4. Sure. Including entire operating s systems. A quick google search will uncover much.

  5. No idea about Android. Rust can be very useful for web programming, both in browser and on the server.

As for 3. A while back I was looking for a language to implement a "cloud" service that required now latency. Being "cloud" I was not expecting much but lower is better and too high makes the project useless. I was not about to use C++, having decided that after years of pain using it I wanted an easy life. I was not keen on even trying any scripting language, PHP, Python, Perl. I could not imagine any of them would be quick enough and they are all yucky anyway. As it turned out Javascript under node.js and Go were new kids on the block at the time. After some simple prototype testing in both I was amazed to find JS under node offered better throughput and lower latency than Go. Go suffered from major stalls every second or so. Presumably as it choked on all the garbage it had created. So we went with JS and everyone was happy for some years.

Then it happened, after the fall of one company and the rise of another, I needed to implement similar functionality again. As the new owners of the old company were threatening to sue us for borrowing their code I needed to rebuild from scratch and use a different language to distance ourselves from such possibility.

As it happens I had stumbled on Rust in the meantime. So we used Rust. Of course that performs even better than JS under node and has proven rock solid. Even if my "beginners Rust" was an unholy mess and totally suboptimal. Which enables me to sleep at night.

Ah... Sorry for the long essay folks.

1 Like

I think I can answer your first question. I have done java web development before. After reading the book rust programming, I found that I only know the basic knowledge of the rust language, which is far from enough. I try to find more branches of rust projects on GitHub and then learn. Learning the rust language is steeper than learning other languages, but if you persist, you will still find that it is not as difficult as you say.

I think what @scottmcm said is very correct. You should use a language that resonates more with your personal values. I make rust my hobby. Java language for working

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.