[MUSIC]
>> Let's start with the basic,
the most obvious question I think,
which is, what is Go or Golang as it's sometimes known?
>> Go or Golang is a programming language built by Google,
and it's built to address the shortcomings of C++.
It comes with a feature set that's missing a C++
and is also very fast to compile.
It has a speed that's comparable to that of C and C++.
But it's also promising to be easy to read,
which I'm about to show you soon,
so easy to read, in fact,
that it's like Python or that's how they're selling it.
I like the word when they say
that because I really enjoy Python and
the fact that it's so easy to get started
with a prototype, build your thing.
If something is compared to Python, you got my attention.
>> I'd certainly agree with that.
The reason that I'm so wide-eyed here is I've done C++,
and by that I mean,
I took a semester of C++.
I barely made it through it and then just made
a promise to myself never to go back and do C++ again,
that I found it so confusing.
To say, "Hey, this is a language
that's supposed to address the shortcomings of C ++,"
so I'm thinking that complexity,
but yet the syntax is similar to Python.
You've certainly got my intention.
I'm intrigued at how this can actually happen.
How can you take C++ and make this like Python?
>> Yeah, for sure.
I think it's the fact that you are so close to the method.
One of the things that C++ does for you is
the whole memory management is your problem.
You and me both, we started with C++ and it was painful,
and we did any other language except for C++.
That's my first language.
My second one is Java and then C-Sharp and I'm
staying there or JavaScript as well.
Go is very close to the metal,
which means it's super fast to
execute and makes a lot of sense to use
it in like web servers or things where you really need that speed.
This is where Go is supposed to be used.
It's super easy to say, "Hey,
can I use this like it's JavaScript?"
You can, but you're probably better off using no gas.
But if speed is a concern,
Go is your language for sure.
>> We should make sure for anybody who's
not familiar with the phrase,
I'm close to the metal.
What we're talking about here is some languages
like Python or JavaScript are interpreted languages.
What's happening at run-time
is there's an interpreter that's going, "Okay,
this is what we're supposed to be doing,"
and then it's sending those messages onto
your operating system to
tell it what it is that it's supposed to do.
But when you're talking about C++ or C-Sharp even,
which does compile down into that intermediate language,
which is like a step away from assembly or with Go,
it's as close to the language that
the operating system is going to speak natively as possible.
>> Yeah, for sure.
If you compile a Go program,
I think you'll get ones and zeros. You get the machine code.
I think it's really great that you explained that term because I
don't think it's obvious to folks when you select the language,
why is this one fast and why is this a bit slower.
Even then, it's not the entire truth.
Because even if you have an intermediate language,
there are tricks you can do to speed it up.
In today's world, I think you're pretty good with
high-level language that's not that
close to metal in most cases, right?
>> Yeah, I agree completely.
I always like to make this admittedly very glib statement,
which is that developers are expensive,
RAM and processors are cheap,
relatively speaking,
and a lot of times what you're
really looking for is time-to-market.
How fast can we develop something?
If that's what you're going for,
then you can overcome
some of the performance issues that you're going to have with like
Python or JavaScript by just
throwing more processors at
the problem and throwing more RAM at the problem.
But obviously, you are going to eventually hit a point where
you can only throw so many processors at it,
and it's just not going to give you that performance.
Then at that point,
you need to turn your attention to a language, again,
like Go like you're mentioning or
C++ something that is going to be
down on the metal and going to give me
that better level of performance.
>> Yeah, for sure.
>> I'm trying to figure out what question
is it that I want to ask you.
How do I write a Go program?
I want to use that and then spin
into getting into serverless here.
How do I write a Go program?
>> You start with a text file like you
do in a lot of code languages,
but you do need to install the run-time.
If you're on a Mac, you can install it by a Brew.
I believe if you're a Windows,
there's an installer package.
Once you're there, once you set up and running,
you just need to name that file .Go.
There's also a way to, once you grow up a little bit
in your knowledge to use a more project-based approach,
we're not going to be that far today,
but for the show, I [inaudible].
Start with that text file,
you name the file ending .Go and you start typing.
As with a lot of programming languages out there,
there's always this entry point.
There's always this first function that you need to call
that spins up the entire app and Go is no different.
Compare that to a Java program,
C-Sharp, you have an entry point,
you have that first main function,
if you will, and just the same thing with Go.
You start there. Start with a text file,
have that entry point and fire away.