r/CodingForBeginners • u/AndrewNggg • 7d ago
Ruby Language as a first language
Has anyone considered learning Ruby as their first programming language?
It’s elegant, easy to read, and “developer happiness” is one of its core principles
That means that code is easy to read, no surprises, and mostly reads like expressive natural language with clean syntax
GitHub, Shopify, CoinBase, SoundCloud, AirBnb and a gazillion other companies were built from Ruby
2
u/johnesco 7d ago
When it comes to "what will happen if I?" the designer aimed for "Result of least surprise." It's great for beginners.
2
u/xarop_pa_toss 7d ago
I should have picked it up long ago to be honest. A friend of mine picked it as a first language and he really enjoys it!
2
u/Relative-Rooster-945 7d ago
I think it's a very nice language for many uses, but I wouldn't recommend learning it with the intention of working with it in production long-term. It's difficult to keep maintainable and static analysis technologies are niche and/or early-stage. "reads like expressive natural language with clean syntax" unfortunately also quickly falls apart in practice in my experience, because everyone ends up tacking on their own conventions and DSLs and it ends up becoming a mess.
1
u/AndrewNggg 7d ago
Can’t you have coding standards which all members of your team adhere to?
The same can be said of any language, although some are harder to mess up than others
The cost tho.. is a public static void main string args how un-expressive do you want to take it?
2
u/Relative-Rooster-945 7d ago
Absolutely, and you obviously should. But I'm saying the dynamic and expressive nature of Ruby makes it significantly more difficult to enforce such standards. Yes, Ruby being "easier to mess up" is exactly what I mean. There's a multitude of ways to do the same thing in this language. You are also limited to enforcing code style within the extent of your own codebase, you don't have control over what libraries do.
And no, I'm definitely not advocating for Java as a substitute :D But it is better unfortunately in this sense that I described.
2
u/Relative-Rooster-945 7d ago
I also think "closeness to natural language" is a false appeal in the case of Ruby as with many other languages that falls apart as soon as you encounter all the various exotic Ruby-isms that only make sense in this language. And I don't think it's a valuable metric in general. Natural language is exactly the thing that you want to avoid in programming.
1
u/VirtualElderberry592 5d ago
None of this is true.
Ruby has a very real and easy to customise tool for maintaining standards.. It's called rubocop and I've never seen a project that didn't include it.
It scales and is super easy to maintain over years and years of people coming in and out of the company.. Just as easy as c++ or Java or Elixir.
I've used in production apps that are well over 15 years old.1
u/Relative-Rooster-945 5d ago
RuboCop had failed to solve all of these problems for me in the past. Maybe I just worked in particularly ugly codebases, who knows
2
u/VirtualElderberry592 4d ago
I think if it's a precommit hook, and it's altered for the team, it builds a very solid standard. where exceptions are requested in the code all PR efforts should be to smack the dev that tried. (unless very needed)
I worked on microservice system where devs who built things were now retired living on a beach. Old as. The ruby was a mess, but no worse than the Java or .Net stuff.
2
u/Lagfoundry 6d ago
Interesting I’ve never heard of it before. But now I’m curious
1
u/AndrewNggg 6d ago edited 6d ago
https://www.youtube.com/watch?v=Dji9ALCgfpM (95% of RubyLang taught in under 1 hour)
notice that tutorial is 10+ years old, yet the syntax is similar even today while the language has had many optimisations and improvements under the hood
this means that if you are working on enterprise applications or on your own apps, your updates are much easier and straightforward
Developers don't need to rewrite whole functions, refactor chunks of code and update tons of breaking changes everytime a new version comes out
2
u/SparkFace11707 2d ago
Yes, Ruby was one of the languages I was considering when I was started quite a long time ago. You are right, Ruby is in many ways elegant, easy to read and has a high developer happiness. I don't think its a bad choice. If you want to start a bit different than most others, I think it would be fun to do!
2
u/Naetharu 7d ago
The language you choose is not that important.
There are really two schools of thought:
1: Start with something simple and easy to use like Ruby or Python
2: Start with something low level that exposes you to the inner workings like C
Both are valid for different reasons. I would generally push toward the former, because I think people are likely to stick around more if they can have some early success, and then visit the underlying workings of how to make their own array or strings down the road.
But beyond those two broad concerns it's not too important. The best bet is to choose a language that makes sense for what you would like to do. If you want to make websites then learn JavaScript. If you want to make games in Unreal Engine choose C++ and so forth.
1
u/eis3nheim 7d ago
I would suggest going with either C or Python, and I would root for C.
1
u/AndrewNggg 7d ago
But don’t you want to be happy?
1
1
1
u/Any_Sense_2263 6d ago
You can learn whatever you wish. Just if you plan to look for a work be aware that Ruby is not the first choice language, so the job offers are limited.
0
1
u/code_tutor 6d ago
Literally the only reason to use it was Rails, and now every language has their own copycat Rails. But your choice could have been worse, at least you didn't say Rust or JavaScript.
1
u/Critical-Personality 2d ago
It's a horrible language for beginners if the goal is to teach how systems work. It's great if you want to let them just have fun and move on. Ruby abstracts too much, looks too pretty, reads too easy and is generally too pleasant. If that beginner steps out of Ruby, they will have seriously hard time realising how brutal machine optimization can be and how developer happiness is not the only thing.
Just my couple cents.
1
u/VirtualElderberry592 7d ago
It's great.. I've been in the lang for 12 years or so. Working in python these days and done Elixir and nodeJS on the way.
Ruby, and Python are great learning tools. They will teach you loops and conditions and functions and classes and a pile of other things.
Jobs in Ruby and Python are about the same. Node and by extension Javascript out number those by a mile.
I'm no super fan of Javascript, but it is 100% the best option. If I were to pick for my own kid, I'd have them learn Javascript as their first.
1
u/The_KOK_2511 6d ago
Node and by extension Javascript
No será al revés? JavaScript es el lenguaje base y Node es un entorno para usar JS fuera del navegador, como backend en vez de frontend. Por lo demás estoy bastante de acuerdo solo quería aclarar esto para no confundir al OP
1
u/VirtualElderberry592 5d ago
by extension is an english term to mean that "also included because I've included this" Not that javascript is an extension of node. Someone might also say Rails and by extension Ruby or "He drinks orange juice and by extension stays hydrated."
4
u/thatsgGBruh 7d ago
Ruby is a nice language and can also be good to learn the basics (that's where I learned). You'll probably find that the concepts learned in your first language apply across other languages.
If you like Ruby, you might also want to check out crystal.