Check out a free preview of the full Basics of Go course

The "Characteristics & Timeline" Lesson is part of the full, Basics of Go course featured in this preview video. Here's what you'd learn in this lesson:

Maximiliano explores the key characteristics of Go, such as its static type system, garbage collection, and single binary compilation. The discussion also includes an overview of the timeline of Go, starting from its inception in 2007 to the release of Go 1.20 in 2023, providing a glimpse into the evolution of the language over time.

Preview
Close

Transcript from the "Characteristics & Timeline" Lesson

[00:00:00]
>> So some characteristics, it has a strong static type system. So everything, we have a type, if it's an integer, it's an integer, cannot be a string, as in other languages. It has a C-inspired syntax. However, that doesn't mean it's a super set of C as other languages such as objective C.

[00:00:22]
Or it's not actually based on C, but it has some ideas, for example, we use code blocks with curly braces. So if you have an if, if you have a function, you open curly braces, you close curly braces. Well, that's coming from C. There are other languages, Ruby, Python.

[00:00:40]
Not following that, okay? So have that in mind. Do you need to know C to get into Go? No, not really. But if you have ever played with other C-based languages, maybe you will feel at home with some ideas. That can be Java, C Sharp, C, C++, even JavaScript, PHP, all those languages are coming from From C.

[00:01:04]
It's compiled, so actually we need to compile the code. We developers, we have to compile the code to execute that. It's multi-paradigm, so if you ask me, is it functional programming? Is it object-oriented programming? Actually it's up to you. It's not actually forcing us into any paradigm in particular.

[00:01:28]
The idea is to keep this simple, so we should try to keep this simple, okay? It's garbage-collected, do you know what garbage collection means in your language? If anyone wants to, yeah,
>> Getting rid of the memory, or the objects that are stored in memory that are no longer needed automatically,

[00:01:53]
>> Okay, and you add the word objects there that we don't have here. But that's fine. No, no, it's fine. So yeah, that's correct. So actually a language that is a garbage collector means that when you create a variable, it doesn't need to be an object, it can be any variable.

[00:02:09]
When you don't need it anymore, you don't need to care about that, okay? And unless you have ever played with C++ or other languages objective C, or even Swift for iOS. They don't have garbage collection. You are used to that, so maybe you even didn't know that there were languages that they don't have that.

[00:02:33]
There are some languages when you create the variable, you also need to delete the variable when you don't use it anymore. That was the idea originally. You create something, you delete something before closing your app for example. Because if not, you were creating memory leaks. That is pieces of memories of your computer, of the operating system that are occupied with data, but no one is actually using the data anymore.

[00:03:01]
So after a while, your computer, has no more enough memory for running other apps because it's occupied with parts that are not used anymore, okay? Anyway, we do have garbage collection and the garbage collection system, it's simplifying. It's like, think about the separate process. That is looking into your memory and see if you have some variables or objects that you have created in memory that no one is pointing at.

[00:03:29]
If no one is pointing at an option in memory, it's like, well, no one is going to use that anymore. So, the garbage collector will delete that from memory. So, it's a process that deletes data that is not being used anymore. And why is that you don't have any points?

[00:03:46]
Well, because the variable that was pointing to that thing loses the scope. So I mean the function ends or maybe you assign a different object so the the previous one has no links anymore, things like that. So we don't need to care about that. So we create a variable and we don't care.

[00:04:05]
I mean, I'm overreacting. We should care about memory management, but in terms of deleting the variables that we create, that's not something that we need to do explicitly. It's fast, okay? Remember, that was the goal. So it's fast and that's why there are a lot of Go developers are really excited about Go.

[00:04:24]
And when you say no, let's move to NodeJS and say, no, no, no, no, no. We keep with Go. And typically it's because it's faster. It's faster than any other platform, for example for web services or micro services things like that. And it creates a single binary compilation.

[00:04:43]
So we compile and we create one file. So it's not based, I mean you can do things but by default it's not based on for example DLLs on Windows or dynamic libraries where you have to create several compilations and then link them somehow. Here, the idea is to make things simple.

[00:05:02]
We create one executable output from our code, okay?, Make sense? So it's not really important, but for you to get into the mindset of the timeline of Go, the pressure has started in 2007 but it was publicly announced in 2009. I was there at Google IO when they announced that, and we were all kind of confused about why do we need and use that language we weren't actually understanding the reasons behind this.

[00:05:32]
First version appeared 2012 to around 10 years ago. And right now we are in version one, the training, okay? So if you make all the calcs, it's kind of two versions per year, okay? However, these updates are minor updates. In fact, there is a rule, at least within Go 1.x, that every new version will be always fully backwards compatible.

[00:06:04]
Because they want to reduce the risk of that in the future. So if they add a feature, and sometimes they're adding features, sometimes they're not adding big features, it's just solving bugs or increasing the performance of that function, things like that. But sometimes they're adding some minor updates and sometimes some new things into the language.

[00:06:25]
For example, they have other generics. We will explain what they are later, but they have other generics in a 1.18 that it was released like a year ago. So that's like a new language feature, but it's not like other languages that are evolving like faster compared with Go.

[00:06:47]
Kotlin, Swift, even Java today, they are trying to keep evolving the language all the time. But that also adds risks and also adds some kind of stress to developers that they need to keep being updated every six months. So let's see you Angular. Now we have Angular 25, let's see what's new.

[00:07:10]
They're changing how they're doing things, so I need to test if my code will still work or not. I need to make changes. Well, that stress shouldn't be here, and you can safely update to a new version of Go when it appears or you can keep it with the one you have.

[00:07:27]
You just read the change log and see if the updates that they have added are going to increase performance on your app or something. But they're trying to keep backwards compatibility all the time. There is only one exception to that, is that if they found a security or something like that, they might change the API and they will like give us the warning.

[00:07:51]
Okay, you know what? We have to change that API because that's not typically the normal situation. What about Go 2, there is a project to create the Go 2. Like, okay, but it's going to be like a new language again, and it's not going to force us to move into Go 2.

[00:08:10]
And maybe it will never happen. So we don't know. So it's not like, yeah, in 2025 we will release Go 2, no. It's like a parallel project saying, okay, with the experience that we have gathered over a decade with Go 1, can we do something better or different?

[00:08:30]
But it's going to be a different language, and it's not going to be backwards compatible, okay? So but there is nothing that says that that's gonna change quickly.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now