DEV Community

Cover image for Learn a New Language: Ruby or Go?
Marc Nevin
Marc Nevin

Posted on

Learn a New Language: Ruby or Go?

I'm lucky enough that I can take my time on lockdown to build some backlogged projects, draft some posts and develop some new skills, one thing I've been thinking about is learning some core concepts of a new language.

After looking at what I enjoy, what's popular and what's actually used, I've narrowed it down to Ruby and Go,

The case for Ruby

So many tools I love to use are built with Ruby and loads of great websites are written in Rails. Makes me think there's some real utility there I could start leveraging in my own solutions, not to mention Rails opens a new avenue for webdev!

The only hold-ups I have, it's not got a popular reputation locally, there are a few product teams that use it and talk regularly about how there's not many jobs in it and that they hope to migrate to something else...

The case for Go

Go has a certain appeal to me - most of my stack is Python-based with some JavaScript, using AWS; I used to work in a C/C++ stack and the promises of efficiency, combing my old domain with my current and "easy" integration to my current stack make it hard to not notice.

And again a lot of great tools and services are being built in it or things that were once Python (still my fav) are being ported to Go now, it seems a little less broad spectrum of services built with it?

Decisions, decisions

I'm leaning towards Go, but want some input, I know very few people who actively use either to draw from, anything I've found normally has a strong agenda, so I want to ask here, see what people think and crowdsource some opinions!

Which would you recommend starting with and why?

or if you've any strong experiences working on either, think one is easier to learn etc etc

Top comments (63)

Collapse
 
guivinicius profile image
Guilherme (Harry)

Why not take a chance on both?

I've been working with Ruby for the past, 10 years I guess and I think it's far from being a "rejected" language. There's always a company using or a startup starting on top of Rails or any other framework, like Sinatra.

Go is really interesting and is one of the languages I'm starting to learn also. I decided to learn because I've seen so many interesting projects using it that I want to at least be able to contribute.

Ruby is really nice and easy to learn and if you get Rails right, it's a powerful tool for new ideas.

Collapse
 
m_nevin profile image
Marc Nevin

I've heard a lot of people promise Rails as this one-stop-shop for prototyping which is pretty interesting but I think you're right no reason not to try both,

Responses here have highlighted a lot of good points of both that are worth trying out before longer-term ambitions with one!

Collapse
 
guivinicius profile image
Guilherme (Harry)

I mean, there is no "silver bullet" in our industry. That's why there are many languages, architectures, protocols and etc. Each one has its purpose.

Without going further on the subject (that could increase a lot, discuss market, current and future world economy and etc) I think you could think about a project that you could achieve on both languages, as an API that you made on Python to talk to an IoT device.

That way you will be forced to learn about some libraries in both languages and learn the differences, which could even lead to another cool article here. 😉

Also, you say that Ruby doesn't have any local community where you are, I see that as an opportunity to start a study group there. I bet there are many other local programmers that heard about Ruby or Go but don't start anything because they think no one is using locally.

🔥 You could be the local spark bro! 🔥

I think that's it ... code on both, be the spark and keep rocking. 😄

Thread Thread
 
m_nevin profile image
Marc Nevin

That sounds like a solid idea, trying out some of the main libraries and on-device would make a really interesting test of both languages, and like you say... that's post material right there!

Oh sorry - to clarify, there's a bit of a community, but its... not the most positive bunch, they may have changed since I last took a look but both have very small followings here. I do have 2/3 of my meetups subs free... mightn't be a bad idea to try and engage them again,

Thanks for the guidance man!

Collapse
 
cleysonlb profile image
Cleyson Leal Braga

Golang... becouse Ruby is dying

Collapse
 
deciduously profile image
Ben Lovy

[citation needed]

Collapse
 
sergix profile image
Peyton McGinnis
Collapse
 
cleysonlb profile image
Cleyson Leal Braga

Most companies are migrating from ruby ​​to Elixir, ruby ​​has gained fame because of rails, but nowadays there are several other development alternatives as good, including using node

Thread Thread
 
ludamillion profile image
Luke Inglis

Most companies are migrating from ruby ​​to Elixir

[citation needed]

I keep hearing that but I have never seen anything indicating that most companies are doing this. I've seen a little more evidence that companies are choosing Elixir (or something else) over Ruby/Rails for greenfield projects. But to imply that most companies are actively migrating legacy apps to Elixir is a big assertion to make without evidence.

Thread Thread
 
thepeoplesbourgeois profile image
Josh

My experience has been that Ruby-embracing companies have done very little, if anything, to attempt to transition over to Elixir, for either greenfield or legacy established codebases. Even given the familiar syntax and strong guarantees of concurrency, performance, stability, and flexibility, there's an incredible inertia within teams that have already built up their Rails projects.

Thread Thread
 
ghost profile image
Ghost

I think this is usually a moot discussion because it depends on the local market, we are working all over the world, in some places Ruby may be dying while in others is growing, in some maybe never arrived, it also depends in the circle we operate, even the specific industry we tend to focus. We probably will think our current stack is more popular because of course we have more people surrounding us using it, we probably look for job offers that favors what we know and use, for obvious reasons. Of course to me Java looks less popular, I hate it, I don't even look at job offerings that require Java, so I have less chances to talk with Java people, I don't go to their Meetups nor watch Java YT videos, that doesn't mean is less popular, no idea. And even if it where, that just tells me that is less popular in my city, in the industries I'm closest to, nothing more.

Collapse
 
cleysonlb profile image
Cleyson Leal Braga
Thread Thread
 
deciduously profile image
Ben Lovy • Edited

Every link here suggests the opposite of what you're asserting. Even the graph showing it on the bottom of those four tools shows it has remained steady, not declined.

No, Ruby isn't poised to ever replace or even compete with C++ or JavaScript, but there's also nothing to indicate it's going anywhere for a long, long time. Yes, there are some companies that are migrating to Elixir, but I haven't seen anything suggesting that "most" companies are doing so is accurate. Instead, Ruby is continuing to mature and has a very well defined niche in the industry. The fact that many large systems (like GitHub, or DEV, AirBNB, Stripe, etc, etc.) continue to use it. Rails is declining, but Rails is not all of Ruby, and both Rails and Ruby continue to receive active ongoing development both in terms of core tools and ecosystem. It can both be alive and well and not the #1 language on ranking lists. There's gonna be Ruby to maintain for a long time, and on top of that there's still brand new Ruby code churning out too.

Thread Thread
 
cleysonlb profile image
Cleyson Leal Braga

In your argument you are defending legacy code ... it is the same as saying that PHP is growing because the internet uses wordpress, and saying that PHP is a great choice for 2020

Thread Thread
 
deciduously profile image
Ben Lovy

I don't know that I'm trying to mount a defence, just observing. Ruby has been "dying" since like 2007 but still has yet to actually get around to it, and I don't think anything is different now except that the language itself is much, much stronger than it ever was back then. I try not to feel too strongly one way or another about these things on a personal level, it's all just tools for a job. Ruby is a pretty good tool, I don't think it's accurate to say that Ruby suffers from the same inherent issues as PHP for greenfield development.

Collapse
 
itachiuchiha profile image
Itachi Uchiha

Is there any proof? For example, the lowest commit counts can be an example. You can say there are tons of issues that haven't closed yet, etc.

Collapse
 
brownio profile image
Antonio Djigo • Edited

I would go for Ruby only if you are going to do Web Development, Rails its awesome, curated, etc, ruby syntax is lovely.

If you are thinking about "A language I'd like to use for almost everything I do", I'd go with Go.

Both are awesome, but Go is growing better in my opinion, also, the Gopher logo is way cooler

😎

Collapse
 
m_nevin profile image
Marc Nevin

Ahh nice, this is the sort of response I was hoping for!

I'm leaning to Go but a few raised the point of trying both so I'll have to look at both your posts :D

Collapse
 
brownio profile image
Antonio Djigo

Glad it helped!

Collapse
 
phantas0s profile image
Matthieu Cneude

Here's my opinion:

It doesn't matter. It's difficult to predict what language will be more used than the other in 5 years, if interesting company will be more on the Go or Ruby stack, and so on.

It doesn't matter because more language you'll learn, easier it will be for you to learn new one. It looks like you already have a solid background in low level languages, so it shouldn't be a problem. You can still learn the one you didn't pick later.

Development is not about languages, it's about choosing the right tool to find the best solution.

Collapse
 
m_nevin profile image
Marc Nevin

Very very true, languages are tools; part of the reason I want to pick a new one up is to expand how I think when designing solutions - each new tool opens new possibilities or techniques

Quite a pragmatic way of looking at it but I definitely agree with you

Collapse
 
phantas0s profile image
Matthieu Cneude

That's a very nice goal. Learning a new language is always a very interesting experience.

Personally, I try to learn new languages which are different of what I use everyday, to learn a maximum. That's my only criteria.

I wrote about how to learn a new language here if you're interested.

Thread Thread
 
m_nevin profile image
Marc Nevin

That's a good way of scoping it, I'll definitely take a look thanks!

Collapse
 
madeindjs profile image
Alexandre Rousseau

I really depends to your needs. But Ruby has a great ecosystem to build large application without reinvent the whell. If you choose Ruby on Rails you can build an API compliant to JSON:API standards with JWT token auth, email validation, unit test and even deploy on Heroku in only one hour. Check my free e-book if you don't believe me.

With Golang you may spend this hours to choose the right library.

Please do not listen people saying Ruby is dying. Github himself run on Rails 6.

Collapse
 
developius profile image
Finnian Anderson

Yeah, I suppose I don't have much experience with distributed systems and hadn't considered exception handling.

For ActiveRecord (think model validation), I've used the pattern of appending to a list of errors and then doing @errors.any? to determine whether a call was successful or not - quite liked that. It kind of overkill if you want to bail at the first error though, since errors.count will always be 1.

That's a great post, thanks!

Collapse
 
developius profile image
Finnian Anderson

I would say it depends on what you may like to do in the future.

I’ve been using Rails for 3 years now and imo, nothing compares to it for web dev. I won’t be changing backend stacks for a while. It’s just lovely.
These are points about Rails though, not Ruby. I have no numbers on this, but I expect a vast majority of Ruby code currently running is because of Rails. So, unless you’re wanting to do web dev, maybe something with broader horizons is a better bet.

I tried learning Go a year or so ago and I did enjoy it. However, I intensely dislike the verbose-ness of error handling - leaving this code all over the place just annoys me:

if err != nil {
    return err
}

I prefer catching exceptions to returning errors.

Go would also be a good bet if you’re wanting to get involved in any OSS projects as a lot of the larger ones (Docker, k8s etc etc) are written in Golang. Go is definitely something I’d like to spend more time learning as I think it’s a good investment for the future.

Let us know what you pick and how you get on!

Collapse
 
m_nevin profile image
Marc Nevin

Fair points! Nice to hear someone who's tried both!

I've heard nothing but wonders about Rails but I'm not sure its something I'll end up fitting into my stack any time soon - Ruby itself still has a great promise though

I'm coming round to thinking it's probably best if I try both and see how my personal preference plays but I think I'm mostly set on starting with Go, the promise of big OSS projects are tipping me a little,

Then after a while with Go, moving to try Ruby on a similar problem and some Rails then next time I'm doing some WebDev!

Collapse
 
david_j_eddy profile image
David J Eddy

I feel like this is a more a question of what is the right tool for the job? In my mind I see Golang as a system tools language, whereas Ruby/Rails is a web app language.

Collapse
 
andyhaskell profile image
Andy Haskell • Edited

I've been a Gopher since 2013 and definitely really like the language for making concurrency easy, its static types, similarity to pretty much any other language, small list of OOP vocabulary, big standard library (I made my personal logo in Go's image package without a single go get!), and supportive community.

I don't know a ton of Ruby, however both languages excel in web development with Rails and Gorilla/Buffalo, both have enormous communities, and both make really readable code for different reasons. Either way you can't go wrong!

Collapse
 
weirdmayo profile image
Daniel Mayovsky

If the "tools I love are built on" factor is important to you, I'd recommend Rust instead of Go. A lot of C++ and C programs (cat, grep, etc.) are being rebuilt on Rust, and the language's community is thriving, so I would recomment Rust over Go, if you'd rather stick with a compiled language.

Collapse
 
rhymes profile image
rhymes

Try each for a week and then decide

Collapse
 
m_nevin profile image
Marc Nevin

Hard to argue against that logic!

Might try and find a topic with big crossover in both and build it in both...

Collapse
 
rhymes profile image
rhymes

Just don't build a web framework :P

Thread Thread
 
m_nevin profile image
Marc Nevin

But I've this great idea! I'll call it .... uhm... Tracks!

Wait... okay fine no web frameworks...

Collapse
 
allentv profile image
Allen T.V>

If DevOps and tooling is something that you are interested in, then definitely look into Golang. Most of the recent tools in infra is built with Go. It will take some time to ramp up but should be ramp easily once you get a grip on it.

Collapse
 
hamiljs profile image
Justin

I love both languages. I've been using Ruby since '08 and Go since '18. They are both intuitive and awesome for their own specific purposes. Ruby was made for your everyday development happiness. For me, it succeeds and I write most things in Ruby. However, if I have a need for speed or an easily portable executable, I reach for Go.

 
brownio profile image
Antonio Djigo

For Rails, there is:

  • Better CLI & standardised framework
  • Code practices and design patterns are more standardised
  • Bigger community = More Q&A around google to fix your problems
  • More guides and courses to learn everything properly

I'm not saying Go does not have this, but, for sure these points are not as good as in Rails.

Collapse
 
travislaborde profile image
travislaborde

I had exactly the same question recently. But with a different background (basic -> vb -> vb.net -> c#).

I learned some Go for Hugo and really liked it. Then I learned some Ruby (not Rails) just for "fun" because I kept hearing how "happy" it makes everyone :) I have to admit it has some charm.

I think I'm going to spend more time with Ruby than Go, at least for now. Sinatra in particular and the Rack web setup make it very appealing. I didn't see anything like that for Go. Maybe by the time I get back to it, that'll be there too :)

Collapse
 
m_nevin profile image
Marc Nevin

Pretty good reasoning there!

Totally right about how everyone says how happy Ruby makes them... it might have factored into how I landed with it as one of the two to pick between,

Think I'm leaning to trying Go first and building something but tools like Rails and Sinatra mean I will be giving Ruby a go too afterwards