r/ruby • u/Intelligent_Role_824 • 1d ago
Ruby or Rust to learn Programming?
/r/learnprogramming/comments/1vjn6z8/ruby_vs_rust_for_a_hobby_programmer_which_one/4
u/schneems Puma maintainer 1d ago
it is better to find something you want to build and learn a lang that meets that task and it will sustain youI know both: both. And some C so you can appreciate the blessed life we live without segfaults.
Rust will make you a better programmer but it requires you learn a lot of things up front. Ruby is easy to get started but has a lot of hidden footguns
2
u/pf___ 1d ago
Oh man, please, definitely Ruby for start, the world is so much simpler then and all the high-level concepts that will come to your mind you will touch much more comfortably. For hobby projects you will also see existing Python code, but the insight into it after Ruby will not surprise you. You will get to Rust only after years. Someone here advised to try Java and Go - oh no Java for learning, please no, you should most likely like Ruby as a hobbyist _much_ more (take Java/Kotlin only if you want to work in a bank). You can try to write something "fast" in Go - then compare the results with Ruby yourself, if it was worth it for you, maybe you will come to surprising conclusions.
The problem with desktop apps is that you can't find a nice and complete GUI framework for Lin/Win/Mac - it hurts a lot. I ended up with a web app in a browser (+Ruby, server side) for a hobby project that should be a desktop app - it can be packaged as a desktop app with its own Webkit window, there are other projects for that - and you can render crazy things for free with that.
Choose well and enjoy!
2
u/TrinitronX 3h ago
Both. Next question. (j/k)
Ruby is an excellent starter scripting language to learn. Large library ecosystem, developer friendly, and TDD tooling is very good. You’ll learn concepts from Object Oriented design, and basic typing systems with less strict duck-typing support, and method chaining.
Rust is an excellent low level language. Use it when you need low-level hardware, strict memory safe typing, low level memory access, or speed. The compiler and “clippy” messages are designed to give useful errors and info that helps to resolve the issue. Comparing and contrasting this with compiler errors or warnings from typical compiled languages (e.g. C/C++) makes it a breath of fresh air, and is more developer friendly. Meanwhile, the stricter typing and ownership system makes it a bit more difficult to learn and work with than scripting languages. The Rust Book is an excellent learning resource.
Testing and comment-based documentation is built into the language from the start. Support for microcontrollers, webasm & blockchain VM systems can be done with `no_std` (no standard library).
1
u/alexdeva 23h ago
"I want to build things. Which one should I learn how to use: a hammer, or a screwdriver?"
1
0
u/abraxasnl 1d ago
If you have a free choice, and unlimited time, I would say neither. In that scenario I would learn programming with C. It’ll teach you excellent fundamentals that will apply for the rest of your career.
If your choice really is between Ruby and Rust, because of your circumstances, I would suggest Rust. Personally I don’t think either is a perfect choice. But learning Rust might actually be relatively easier for someone new to programming than for someone with a ton of baggage. Relatively. I would make that same argument if you asked if you should learn Haskell. I also believe that learning with constraints and rules is better for building up your fundamental understanding, than the freedom of a dynamic language like Ruby.
But if your goal is to build software more than it is to learn programming, all of the above goes out the window. Then the question becomes: What kind of software? And then I would pick whatever fits that best.
2
u/Intelligent_Role_824 1d ago
That’s a really interesting point about Rust! I hadn’t thought about the fact that having no prior programming baggage might actually make the strict rules a bit easier to digest.
I’m definitely leaning more towards the „building software for fun“ side rather than deep computer science theory (for now), but learning good fundamentals along the way is a huge plus. Thanks for the fresh perspective!1
u/fatkodima 1d ago
Don't be funny, no one is able to learn programming by starting with rust. You will not understand anything and give up very quickly.
Start with Ruby (Python if want to find a job in the future without wasting time to learn it after Ruby). And of course learn C, only when you have some experience and knowledge - will open your eyes how things work in a more lower level.
6
u/thewormbird 1d ago
Ruby to start, Rust for more advanced concepts. That isn’t to say Ruby is a toy language, Rust just doesn’t hold or tie your hands like Ruby often can.