This course has been updated! We now recommend you take the Basics of Go course.
Transcript from the "Introduction" Lesson
[00:00:00]
>> Hi everyone, let's get started. Welcome to Introduction to go for front end developers. A major question that might already be popping up in your minds are why are we talking about go which is a back end language for a front end specific series of workshops. And a little background, I work on a really small team.
[00:00:17] I work on a team of four developers, two of which are on the back end team and two of us are on the front end team. And we are building a complex full stack product. My skill set and interests do lie primarily in the front end. But it's not uncommon for me to want to make a PI of the back end code base, explore a little bit about how that is structured and why my front end code is interacting with it the way it is.
[00:00:39] And building a familiarity with the back end has been incredibly helpful for me to understand why my code is structured the way it is and how to optimize that to interact with the back end in a better way. So for this talk, I want to talk a little bit about the go back end language but from a more front end perspective and kind of talk about the nuances of what makes it particularly interesting coming from a dynamic language like JavaScript.
[00:00:59] So a little bit about me. My name is Brenda Martinson. I live in Denver, Colorado. I'm currently working for a small company called hiring.io. We are in the throes of building a really complex product that is, creating an open data platform for commercial insurance. And to do so we've had to change between whether we're using node, go, what our front end stack looks like.
[00:01:23] And as we've been interacting with that, being able to help contribute to some of those refactoring sessions has been really helpful. Before that, I was working at Sendgrid, where I was on a front end engineering team, building a pretty complex UI around drag and drop user interfaces. And then our back end at that time was a rails kind of monolith with a go back end as well.
[00:01:41] And then before that I was working as an instructor at the Turing School of Software and Design, writing primarily the front end curriculum and teaching some front end instructional classes there. But it also was a back end heavy program at first. So the kind of theme is that like even though I do primarily work in front end at no point in my career have I been 100% in that front end world.
[00:02:00] And so having that understanding of how the back end also comes into play has been super helpful and shapes a lot of what I do today. If you haven't already, the repo will be up in the right hand corner there for you. It is on github.com/MartinsonBJ/FCM-intro-to-go. We're gonna talk a little bit about installation first but then down the road we will be doing some exercises in the actual repo.
[00:02:28] So if you clone it down, you can kind of have some hands on experience to the repo itself. Brief introduction of what today is gonna look like. Let's talk about what go is, where it came from, kind of why it's a thing. We'll do installation setup, make sure everyone's go on their machine up and running successfully.
[00:02:44] We'll talk about the basic syntax and structure of the go language. And then throughout the workshop today we're gonna be building some really small exercises and then towards the end, we'll do a little bit more bigger picture web server structures and stuff like that. At the very end, we'll look at concurrency, some multi threading and then what go 2.0 and the recent release of go 1.13 has to offer.
[00:03:07] Also kind of as we're going through, there's a lot of information that's available on the slides. And so here's kind of the layout of what you're working with in the upper left hand corner, it's kind of a breadcrumb series of where we're at in the workshop, what our category is, what we're talking about.
[00:03:20] In the upper right hand corner is gonna be any files I'm referencing, whether that's something for reference, like a markdown file with notes or some of the lecture notes. And then anything in green will be an actionable file. Either file you can use as an exercise file or a website we'd like to visit to kind of play around with something in the browser.
[00:03:40] So brief history of go. So go was developed in 2007 by a team of developers working at Google that were primarily working in c plus plus. Performance and scalability at that time and go are hot topics as they are today. And go or Google was in the throes of kind of like scaling to be the giant company it is today and the scalability at the time was becoming a real struggle.
[00:04:04] And it was difficult to maintain the codebase. And the developers were kind of like, concerned about three primary factors about what made their lives as developers particularly pleasant. So a few things that are really important as you're developing code is, do you have fast compile times? How long does it take your code to reflect something that you have just done?
[00:04:22] How easy is it to develop on a daily basis? Are you happy working in the language you are? Are you kinda going crazy with some of the nuances of it? How does it feel? And facts execution of build times when you do finally wanna build and compile your code and test it and run it, how long is that feedback loop before you know what you wanna do differently?
[00:04:39] At the time, all three of those things were hard to find in the same language. You could get one, maybe two. But all three was kind of like this magical unicorn that didn't exist yet. And so the developers were kind of like, all right, we can do better, whether we build our own language that has all of these things in it.
[00:04:55] So that's where go comes into play. And what makes go a particularly great language to work in is it kind of fixes all those problems. It has a really fast compile time. And although it still has a lot in common with C, there's some of those similarities. You'll see patterns and behaviors of C throughout the go syntax.
[00:05:10] It reduces a lot of the complexity and boilerplate that makes C particularly difficult to write in. And then it does have a really fast build time. So that feedback loop of figuring out what your application needs to do differently, happens pretty quickly, which is great. And the way it does this is few different ways that we'll talk about throughout today.
[00:05:28] One of which is it maintains a lightweight type system similar to Cs. It manages multi threading and asynchronous behavior through concurrency using tools like go routines and sync packages and stuff we'll talk about later today. It is an automatically, the garbage collection is automatic. So you as a developer don't have to worry about opening any allocated memory as you're coding.
[00:05:51] The dependency library and convention are on syntax and kinda what the right way to write go is is pretty consistent and well maintained by the community. So it takes a lot of the mental effort out of how do you feel today? Do you wanna write semicolons or no semicolons?
[00:06:03] There's a much more strict rules around that type of behavior.