Check out a free preview of the full Polyglot Programming: TypeScript, Go, & Rust course
The "Introduction" Lesson is part of the full, Polyglot Programming: TypeScript, Go, & Rust course featured in this preview video. Here's what you'd learn in this lesson:
ThePrimeagen introduces the course by discussing the reasoning behind using three languages in this course and providing some personal background information. The course workflow, what languages students came to learn, and a general course overview are also covered in this segment.
Transcript from the "Introduction" Lesson
[00:00:00]
>> Well, hello. We are doing what I consider the greatest course I have personally ever done today here on Frontend Masters. I'm pretty excited. We're gonna be going over three separate languages at the exact same time, a management of three I believe is what it's called, might be said differently in different languages.
[00:00:16]
And it's gonna be TypeScript, Go, and Rust all at the same time. I'm pretty excited. I hope you guys are very excited. Audience, are you guys excited?
>> [NOISE]
>> Okay, I like the excitement. I could feel it deep down. So why three languages? The big thing is I'm pretty sure most people know TypeScript or JavaScript.
[00:00:34]
This is just standard. And it's really hard to start a new language, especially if it's far away from what you know. And it's also really annoying and there's just so many things that go wrong. And specifically with Rust, it's just classically known as just a really annoying language to get started with.
[00:00:50]
And so I spent all that annoyance and all those emotional tears and rage quit several times before actually successfully becoming good at Rust. And I figured I could just try to make something in which we'll give you, here's a problem solved in the language you know. Here's a problem solved in a language slightly different.
[00:01:09]
Here's a problem solved, the same one, solved in a language you just have very little idea about. It may look familiar, but it's completely different. And that way you can kinda relate these concepts in a much more understandable way. Who am I? My name is ThePrimeagen. Now, this might sound like an odd name, but if you knew the back story, it's actually not that odd of a name.
[00:01:30]
Yeah, I'm not gonna tell you the back story. I'm just saying if you knew it, it would not actually be all that strange. So I took these pictures a little while ago. I liked this one cuz it had all threes, but I stream on Twitch, I am also on the YouTubes and, yeah.
[00:01:44]
So you can find me out there. And I also work at a small DVD company. We ship DVDs across the United States. I hear about this streaming thing. I'm pretty excited about it, a little skeptical. We'll see how it goes. And so, yeah, for those that don't understand this level of humor, I work at Netflix.
[00:02:02]
I work on the television. And I neither work on the front end nor the back end, so I always feel really strange because people ask me that question. What do you work on? I don't know, app end? Which sounds a little different if you're not really listening, and it's just always a kinda funny thing to go on.
[00:02:19]
So the pace of this is gonna be fast. We're gonna be obviously doing a lot of languages and I'm gonna be moving pretty dang fast. And if you wish to be able to move with such speed and swiftness as I do, well, you gotta learn VIM, VIM, the greatest editor of all time.
[00:02:33]
You may have heard of it, 1976, Bill Joy. Not a big deal if you haven't, not a lot of many people have. And then second, developer productivity, being able to use more of your operating system in a more powerful way, being able to jump around and get things done.
[00:02:47]
I really enjoy it. By the way, little fun fact, this laptop, I haven't used it in six months. Jumped on, hit my Ansible scripts that I did for this Frontend Masters. Everything's updated, I'm on the latest Neo VIM, and proof is in the pudding of course, look at that, look at that.
[00:03:01]
0.8 Bleeding Edge, we may just air out because it's so new. Anyways, so yeah, it was pretty fun to do. I am very, very excited. Are you guys ready to do this? Okay, good cuz we got some more talking and then we're gonna do it. I do put this note in here, I actually just, I wrote this before I did a YouTube video, but I did a YouTube video on this just yesterday.
[00:03:24]
Which is stop Googling as much, right? I think a big problem that we have, especially as developers, is that all the answers are always at our fingertips, and so therefore, you don't take the time to really remember things. And so with this course, I may forget the exact syntax and I may go in there and play a couple times before doing anything.
[00:03:44]
You're probably not gonna see me google, but it's not because I have everything perfectly memorized or am I walking an exact roadmap. I don't have anything really strongly planned for the exact shape of code other than a few key points. But the point is that you shouldn't have to google if you have enough of it in your head.
[00:04:00]
And if you practice enough times, you won't have to do that. And ultimately, I wanna see you to be the best programmer you can possibly be. And if every single time you need to do something, you're always jumping out of your editor doing something, you're breaking that flow, you're slowing down.
[00:04:14]
I wanna see people fast and just knowing these things. So don't always reach for Google first. Just try recalling it, and if you can't recall it then, yeah, go to Google. So how would crush such great feats as we're doing today? Well, we're gonna be doing a couple things.
[00:04:28]
But one of them, the main part of this will be building a CLI application. We'll be going over it all together. We'll be doing it kind of in tracks, so we're gonna be building a little part of one of them in one language and then building it through all of it, then building another small part and then building through all of it.
[00:04:43]
And we're gonna just do that about four times to get all the way through the program, should give you enough understanding of the language. I always think that a good measure of the language is how it processes the strings. I feel like that's very kind of fundamental thing we do.
[00:04:56]
We either add, we add one, remove one, add one to a list, remove something from a list, or manipulate strings. That's pretty much our job 95% of the time. And so for me, this is how I judge languages, so I think that's a pretty good one. So before we begin, I do wanna take a quick poll.
[00:05:14]
Who here, or at least in here at audience or Twitchchat/frontendmasters, type 1 if you if you agree with this, who came to learn Rust or potentially get better at it? All right, so we got a lot of potential Rustaceans, as you guys have been lovingly known as. This is excellent.
[00:05:33]
Okay, I see a lot of ones flying by as well. How much Rust, at least you five, how much do you guys know? Okay, we've got a zero, a little bit, little bit, lot of zeros. Okay, a lot of zeros, excellent. Who here came to learn Go? All right, okay, so I mean, don't feel guilty that they did, you don't have to join it.
[00:05:55]
All right, how much Go do you do for now? Do you know Go? Is that why you didn't come here? Okay, if I can do it, I already know it all. And of course, this is kinda the whole point. Who knows TypeScript? Yeah, okay, so this is kind of why I chose TypeScript as the jump off language cuz I figured most people are gonna either know JavaScript or TypeScript.
[00:06:16]
Very simple language, right? It's actually one of my favorite languages as far as syntax goes. Extremely simple to understand. Very simple to do stuff. And then plenty of fun convolution and footguns out there. So you get all the best of every world, right? Simple to understand and dangerous, favorite things.
[00:06:33]
So where did this course really come from? Due to the twitching, the saying stupid things on Twitter, and YouTubing, I get this question almost every single day of my life, which is, what should I learn next? How should I learn it? What should I build? Where do I start, right?
[00:06:50]
I just get these questions constantly, and I always answer the exact same thing, which is, you should build what is useful for you in a language you want to learn, right? For me, that's the only way I can ever learn something. And it's the same reason why I didn't start off by reading the Rust book, even though that's considered the best way to learn Rust, is that for me, I can read all day and just nothing really feels like it concretely sticks.
[00:07:13]
It's been this way my whole life when I was in college. I could crush out the proof for how to do derivatives slash the integral proof, but I didn't understand what I was doing. And then after doing all the integrals, I was like, okay, I understand, it now makes way more sense.
[00:07:29]
I'm definitely a work backwards kinda person, and I feel like at least half the people are that way too, where concrete is much easier than the abstract. And so for me, just banging my head against a wall, not using language correctly, just hacking my way through, is one of the best learning experiences for myself, and then going back and learning.
[00:07:46]
And so I say this every time, which is, inevitably, if you work at a job, if you are doing things, if you're learning, if you're in school, there's like a hundred things that kinda bother you about your environment, about what you're doing. There's plenty of things you can build.
[00:08:01]
There's things you want to build. So you just gotta pick something and do it. Pick a language, it doesn't even have to be the best language for the task. If the sake is learning, then every step of the journey is you're achieving your goal. And that's kinda how I look at, I don't even try to finish all my projects, because A, no developer actually finishes their projects, but B, it's just that's not the point.
[00:08:21]
The point is not the end. The point is actually taking each step is an end in of itself. All right, and of course, I love building CLI apps, I already kind of explained that. I think they're one of the best ways to really understand what the language offers cuz you're just pretty much working with their STD.
[00:08:37]
And you get what you get out of it, or else you have to download a bunch of packages. So you can kind of gauge what the language does and does not do for you. And here's the roadmap, it's mostly correct roadmap. We may deviate from time to time, but effectively, we're gonna start with just getting familiar.
[00:08:53]
I am gonna go over a little bit about the languages, just in general. So you have maybe the right words to use, some basic understandings. And then we're gonna hop in and just start doing things. And so part 2, we're gonna actually just do some simple string parsing problems, and we're gonna go through three of them.
[00:09:11]
And we're gonna see how they feel, and hopefully, I can use some more fun features from the languages. Part 3, we'll just start building the CLI app. Part 4, we're gonna build the core of the program. Part 5 and 6 were accidentally removed and not updated here, and part 7, of course, the conclusion, which I think is the best part.
[00:09:30]
I do have one regret, though. I know I've just been talking nonstop and fairly fast, but I do have one regret, which is, I really wanted to add in concurrency. It's awesome. It really makes these other languages way outshine TypeScript because TypeScript does have concurrency, yes. It can execute, but it has no parallelism, right?
[00:09:51]
Unless if you consider VA to reading things from a socket underneath the hood while your program is executing. The language itself, JavaScript, does not run in parallel. And so you don't get a lot of these really awesome benefits of say, knowing something like Go, where it's extremely easy to get parallelism right, and it's really fast.
[00:10:10]
And so if you're at a startup and you're like, okay, we have tens of thousands of users, we can either spawn a bunch of Node machines or just have one simple Go thing that's just running at pretty much nothing even using the machine, cuz it's just fast and it's so easy to get right.
[00:10:26]
And so I really wanted to work that in, but Go's complexity with concurrency and parallelism is really small, very easy to grasp, but Rust's is really hard. It has all of the right words that you're familiar with from JavaScript, async await, but it's just way harder to get right.
[00:10:45]
And I've built many a web server at this point in Rust, and I've gotten it wrong almost universally every time, but now I actually feel like I get it right. But people still tell me that I've gotten it wrong. But it's much, much harder. And so I didn't wanna spend the whole time explaining async await as opposed to just building something.
[00:11:05]
Second thing, we're gonna pretty much never touch lifetimes. For the most part, if you're not writing really, really performance-driven code in Rust, you don't have to touch lifetimes. There are lifetimes happening, they are implicit, you just don't know that they're happening. And we'll kind of talk about it, but we're not gonna be building things that are the single most efficient form of what they can be.
[00:11:27]
There will be a little bit of copying here and there, and I'll explain it as we come to it like, hey, I'm copying for the sake of not having to go through all this. Cuz I think lifetimes are just something you build when you're building the best form of an application.
[00:11:39]
It's not something you do if you're just kind of learning the language. And so that's how I feel. And lastly, I am gonna try to write these mostly canonical, meaning people use this term canonical or idiomatic. I'm gonna try to write it in the most sensible fashion for each of the languages.
[00:11:57]
But I'm also gonna compete with myself and try to write it such that each language has an easier one to one jumping. So not everything is gonna be as idiomatic Go or canonical Rust or whatever the term, Rustaceous Rust. It's just it's not gonna be able to do that every single time cuz I do want it to make an easy translation, and I think ultimately, it's better to learn that way.
[00:12:19]
Because if you're always bogged down with doing things the most canonical way in some language, you often just find yourself always googling and looking at other people's code. And canonical doesn't always mean the same thing to everybody. Like right now in JavaScript, our class is canonical or not, right?
[00:12:34]
Well, half the community hates classes, the other half, things are just fine, right? So it's like, what makes something the de facto way? It's hard. So it's time. It's time to get ready to program. I hope you're excited. But hold on. Do you have Go installed? Do you have Rust installed?
[00:12:51]
I did link these right here, so you can even just type it straight off the screen. I figured we could take a quick moment, let everyone see this, make sure it's installed, go.dev/doc/install, very, very simple. 1.18 has generics, very good, we won't use generics. The syntax kinda sucks, but it does have generics, and it is very, very good.
[00:13:12]
Second, Rust, you just do a nice little curling of a script that exists on the Internet and just run it on your machine, because you should always do that, find scripts on the Internet and just run them. Cuz nothing bad has ever happened from that. And if you want, you can get Rust nightly as well.
[00:13:28]
Rust nightly has some pretty cool features, but obviously, it's a little less stable. I actually think that the best part of Rust is still coming, right? It's still a pretty fast evolving language. A good example is that in nightly, there is FS exists, at least last time I checked was like a week ago.
[00:13:43]
And in stable, you have to ask for the stats, and if it does not exist, then you don't have the file exist, right? It's still kind of evolving and becoming easier to use. Use whatever works for you. The thing is, whenever you use these installation managers, just make sure that the version is high enough.
[00:13:59]
I don't know what Go comes down. I think with app, Go is at 113 or something like that. It's pretty far behind. So I just tend to just install it from that. Obviously, for those that join me a lot in Twitch, this is me trying to be a little bit more subdued.
[00:14:15]
We're doing educational content. I'm not screaming and making Flappy Birds, which we all know the name that you guys chose on Twitter. I won't even say it here, it's disgusting.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops