DEV Community

loading...
Cover image for Learn a New Language: Ruby or Go?

Learn a New Language: Ruby or Go?

m_nevin profile image Marc Nevin ・2 min read

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

Discussion

pic
Editor guide
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 Author

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 Author

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
brownio profile image
Antonio Djigo

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
talentlessguy profile image
v 1 r t l

and Go is great for web development too

it has an std package for literally any task

Collapse
brownio profile image
Antonio Djigo

It is! I just think that Ruby experience in Web dev is more pleasant and everything is better pavement (the more years of usage the framework has, the more refined it is)

Thread Thread
talentlessguy profile image
v 1 r t l

what makes go less pleasant in your opinion?

Thread Thread
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.

Thread Thread
talentlessguy profile image
v 1 r t l
  • Basically almost everything is standardized – HTTP routes, SQL databases, templates etc. Go CLI... I don't understand what's difficult in go run server.go

  • There is an official style guide, and tutorials how to do best practises

  • Community is very huge in Golang. There are tons of packages and a ton of stackoverflow questions

  • There's Go Tour, Go Docs, and Go Tutorial. All of them are official. I don't understand what problem is here.

Collapse
m_nevin profile image
Marc Nevin Author

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
cleysonlb profile image
Cleyson Leal Braga

Golang... becouse Ruby is dying

Collapse
deciduously profile image
Ben Lovy

[citation needed]

Collapse
sergix profile image
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
deciduously profile image
Ben Lovy

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
citizen428 profile image
Michael Kohl

That's fine, it's been "dying" every year since 2012 and yet here I am, still earning my living with it after 15 years.

isrubydead.com/

Collapse
talentlessguy profile image
v 1 r t l

but you currently use a site written in Ruby...

Collapse
cleysonlb profile image
Cleyson Leal Braga

Last update: 17 months ago
My old site :p
Everything I said does not mean that I am against ruby ​​... the language is nothing more than a tool, be it ruby, go, python, any language you learn will add you, my vision is in relation to the market, I worked with ruby for 3 years ... today if you are going to study for the market, I would say to study javascript, but if you are going to learn by learning, anybody will add you.

Thread Thread
citizen428 profile image
Michael Kohl

My old site :p

He was talking about DEV, which is a Rails app.

Collapse
aligoren profile image
Ali GOREN

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
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 Author

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 Author

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
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
hanpari profile image
Pavel Morava

If I may be so bold, I would pick neither.

From quick glance at Google Trends (as a simple indicator), one can see that Go is plateauing and Ruby declining. Which corresponds with how I perceive these languages. But I may be wrong, of course.

Google Trend

I would rather invest my time either into Kotlin (Android), or into Typescript (Web).

As for the advantages of Go over Python, I wonder if there are so many. FastAPI, for instance, boasts being on par with Go in terms of performance. God knows whether this is true or not but Python ecosystem seems to flourish while Go doesn't seem to devour Python's share.

I would prefer Rust if you need a performance boost.

github.com/tiangolo/fastapi

As for Ruby, I see no single reason why you should learn it.

I personally believe that the next big thing will be web assembly. Perhaps that Microsoft with Blazor may surprise us.

dotnet.microsoft.com/apps/aspnet/w...

And what if Huawei wins the battle and Harmony OS emerges?

Does anybody know how to program Harmony?

xda-developers.com/harmony-os-huaw...

Collapse
m_nevin profile image
Marc Nevin Author

Interesting... I kinda filtered to the two based on some criteria I briefly covered above but mostly as they are the two most promising ones I identified that fit nicely into my current stack, with a degree of deviation.

Some of the languages/tools you mentioned though... having briefly done Android and having a load of friends in the space, it's not something I'm going to jump at soon! TS is... fine, I think I remember enough from some unpleasant Angular projects that I think I'd be able to pick it back up quick enough!

Rust is interesting... it's something I've considered in the past but if you start looking at trends, like with Go and Ruby, it's tough to justify using that same measuring stick!

On Web Assembly, definitely think it's going to be big; based on how these things normally go I imagine we'll abstract away from it though (maybe Blazor but signals aren't there for it yet )

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 Author

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
citizen428 profile image
Michael Kohl

I prefer catching exceptions to returning errors.

Exceptions don't travel well across boundaries in distributed systems, which is one of the main use cases for Go. Making errors values allows for defining strategies appropriate for the context. Alas most people don't, so code is littered with examples like the one you show.

Rob Pike's post on this topc is definitely worth a read: blog.golang.org/errors-are-values

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
andyhaskell profile image
&y H. Golang (he/him)

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
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
rhymes profile image
rhymes

Try each for a week and then decide

Collapse
m_nevin profile image
Marc Nevin Author

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 Author

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

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

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 Author

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

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.

Collapse
anshbansal profile image
Aseem Bansal

The part of norvig.com/21-days.html with "Learn at least a half dozen programming languages" might be relevant.
Rails allows you to have an idea of web dev.
Go is being used by for parallel programming.

Which seems more relevant to you? These could give you new perspectives and give you a head way on different type of job profiles. Are you doing this for job? Are you doing this for a new perspective on how software can be built? The choice depends on these answers

Collapse
m_nevin profile image
Marc Nevin Author

New perspectives mostly: learning something that can expand how I think when creating solutions, it's why my preference was leaning to Go, the promise of easier parallel processing seems very enticing!

Collapse
schererja profile image
Jason Scherer

In my mind, pick one, however I do believe one thing, people looking at the trends can mean nothing. What also makes the trends look lower is honestly there are more languages to look at now so yes it maybe down for certain things. Many startups still use Ruby and Rails as it something to get a product out there fast as an MVP. While Go is nice, there are still some things that I find weird about it and pretty hard to get used to.

Best thing is, pick something and make cool things. If it for a job in the end, find what is the typical languages around you and learn that. If for fun, pick something, you may get halfway through the project and realize it isn't what you wanted anyways.

Collapse
freedom profile image
Freedom

I'm also one of million require to work from home this month. Both has great backward compatibility stories except performance are day and night, one thought about Go built-in html/template isn't efficient since it escaped strings behind the screen, alternative template engines libraries can help when you need performance. I choose Go because Crystal language an alternative take too long to compile and work well in a secure server without having to install any runtime or compiler.

You could start reading at Rosetta Code to compare side-by-side and I feel it a lot productive to learn with any utility that can assist you to compile source code and execute when you make changes to your code.

rosettacode.org/

I hope, line of code will not be the main factor in choosing a language, keep writing and get used to it.

Collapse
ziizium profile image
Habdul Hazeez

I'll just Go and find a Ruby.

Collapse
maxwellk profile image
Keith Maxwell

I'd say Go, for two reasons:

  1. I want more experience with static typing

  2. I've been talking to a local recruiter recently and I think Go experience would open more doors for me personally; this is only an anecdote from one little market (Belfast, NI)

Collapse
m_nevin profile image
Marc Nevin Author

A very appropriate little market for me - also live in Belfast!

Think both would grow my skills, just by expanding how I approach designing solutions,

But you're right, looking around the market here, Go would serve better than Ruby!

Collapse
kwstannard profile image
Kelly Stannard

Ruby is no longer hot among the cargo cult crowd, which has pros and cons, but there are tons of jobs and the language is still adding a lot of new features from other languages.

Collapse
madza profile image
Madza

for future perspective definitely Go, for beautiful and easy to pick up syntax Ruby

Collapse
ludamillion profile image
Luke Inglis

...for beautiful and easy to pick up syntax Ruby

Whenever anyone asks 'should I learn Ruby or X' I almost always answer X. Ruby is an incredibly easy language to pick up so spend your time learning something else and then if you ever need Ruby you can pick it up quickly.

Collapse
madza profile image
Madza

Fair enough, some even say the most appropriate 'first programming language' is Assembly. Get to know the core and then move up to higher languages with ease, based on necessity.

Thread Thread
ludamillion profile image
Luke Inglis

I learned with C which certainly isn't quite so close to the metal. It is close enough to make me appreciate what higher level languages take care for you. It does help to be able to dip into the C source as one sometimes has to when digging around in Ruby.

I have written some Assembly but mostly just out of curiosity

Collapse
priom profile image
Priom Chowdhury

I would learn Go and/or Rust if you come from C/C++ background. Similar performance and modern code. I wouldn't really learn Ruby in 2020.

Collapse
geoff448 profile image
Collapse
256hz profile image
Abe Dolinger

I mean if you're gonna go by Stack Overflow trends, you might as well learn Python, Java, or C#. Even Typescript is much more popular than Ruby or Go. insights.stackoverflow.com/trends?...

Collapse
thebayliscode profile image
ian-bayis

No language truly dies. Pick the language that can integrate best with the app that you are working on.

Collapse
cocampbe profile image
Collapse
m_nevin profile image
Marc Nevin Author

Fair point, it seems like there'll be more of a learning curve in what people have said here!

Collapse
benjioe profile image
Ferrier Benjamin

Why do you want to learn a new language ?

Collapse
juancarlospaco profile image
Juan Carlos

If I can only choose between Ruby and Go
I choose Crystal.