One of the questions I get asked the most is how to start with a second programming language. In this post, we're going to look at how I approach learning another language.
Table of Contents
1 - My Story
Before we start, I want to talk about the languages I've worked with and learned.
If you follow this blog, as you may know, I am quite experienced in .NET
, particularly C#
, but since early 2022 I’ve been working at a company where we work with Go
, but mainly program in Ruby
.
Previously, I have worked in my career with PHP
and ExtJs
.
And while studying, I learned the same as everyone who studies in Spain: C/C++ and Java
.
2 - How to Learn More Than One Programming Language
When I say more than one programming language, I mean languages that cover the same part of an application. This does not apply to learning a backend and a frontend language, since those are complementary to each other.
I’m talking about how to learn more than one language, in this case, both being backend languages.
As I said before, I’ve worked most of my professional life with .NET, so my mindset and programming style is quite centered around .NET. Switching to another language is not going to be easy without some effort.
That’s why I recommend building a basic CRUD, a API where you have operations to create, update, delete, and read from the database.
It’s important to use a database, whichever one you choose.
And it’s even more important to program it to a level that you would consider production-ready.
You can skip some validation if you don’t want to spend too much time, but I recommend implementing all use cases thoroughly. And of course, add some tests, even if they’re only covering the happy path.
We’ll build a basic but not simple CRUD. What do I mean by this? I’m talking about applying clean architecture to ensure a separation of concerns, which will lead us to split different layers. The SOLID principles. Add Swagger and return JSON if you're building a REST API, so you'll be forced to research how to add third-party libraries and where to find them.
This way, we can identify the differentiating points between each language.
The idea is that all the versions perform the same action and you get the same result in each of them.
Finally, I’ll add that I also recommend keeping a document with you, either handwritten or within the project itself, where you note down the distinctive things you find compared to your main language.
This is what I did to take my first steps in Go and Ruby. You can see what I mean in my GoPlayground repository. I took the same approach to learn both Ruby on Rails and Sinatra, which is the framework I work with these days.
For example, in .NET you throw an exception with throw new exception(“message”)
, while in Go it's panic(“message”)
, or in Ruby raise “message”
.
3 - Benefits of Knowing More Than One Language
One of the great benefits you can discover is noticing what's missing from the language you're working with that you can bring over from others to improve your primary language.
For example, my Railway Oriented Programming library is based on a talk by Scott Walchin about how F# Monads work.
Another huge benefit is that knowing more languages lets you pick the best one for certain implementations. After all, programming languages are tools and we should treat them as such.
Finally, a major benefit is that knowing more languages opens doors to jobs you might not have had access to otherwise. While it's true that many companies don’t care what languages you’ve used in the past and see languages as just tools, there are plenty who don’t see it this way. If you don’t have experience in a particular language, they might not even respond to you, or, in the case of recruiters, not even call you.
Having more options will give us a boost both in salary and in the projects we get to work on.
I don’t want to create a separate section for disadvantages since we only face drawbacks if we neglect the languages and don’t keep ourselves up to date.
If there is any problem you can add a comment bellow or contact me in the website's contact form