Polyglot Programming: TypeScript, Go, & Rust

ThePrimeagen

ThePrimeagen

terminal
8 hours, 49 minutes CC
Polyglot Programming: TypeScript, Go, & Rust

Course Description

Bend your mind with programming TypeScript, Go, and Rust side-by-side. Get an overview of each language's basics and solve some example problems with each language. In the end, you will have built a fully unit-tested CLI application in TypeScript, Go, and Rust. Become a polyglot programmer and learn to get the most of multiple programming languages!

This course and others like it are available as part of our Frontend Masters video subscription.

Preview
Close

Course Details

Published: August 13, 2022

Learn Straight from the Experts Who Shape the Modern Web

Your Path to Senior Developer and Beyond
  • 200+ In-depth courses
  • 18 Learning Paths
  • Industry Leading Experts
  • Live Interactive Workshops
Get Unlimited Access Now

Table of Contents

Introduction

Section Duration: 14 minutes
  • Introduction
    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.

Fundamentals

Section Duration: 1 hour, 14 minutes
  • Language Fundamentals
    ThePrimeagen live codes the same function in TypeScript, C++, and Rust to demonstrate some base language similarities and differences. The Rust borrow checker is tasked with enforcing that all variables are initialized before they are used, the same value can't move twice, and a value can't move while it is borrowed.
  • Values, References & Mutation
    ThePrimeagen discusses the three types of Rust values, values, references, and mutable references. Values can have only one owner, many references can exist with the constraint that there are no mutable references alive, and one mutable reference and no reference can exist simultaneously.
  • Enums
    ThePrimeagen walks through creating enums in TypeScript, Go, and Rust to demonstrate the extent of enum support in each language. Rust allows enums with many types, including generic, which can be helpful for many typed lists, nullable, and error handling.
  • Enums & Rust Q&A
    ThePrimeagen answers student questions regarding whether you can have an enum that points to itself, why the map has a reference, and what the enum's owner is. A brief discussion regarding macros in Rust is also covered in this segment.
  • Option Enum
    ThePrimeagen live codes map and is_some in Rust on the "option" type to demonstrate Rust's ability to specify additional behaviors by writing functions inside enums. A student's question regarding if impl is a Java interface is also answered in this segment.
  • Error Handling
    ThePrimeagen briefly walks through the error handling in JavaScript and TypeScript and live codes error handling in Go and Rust. In Go, errors are pointers under the hood, so they return the empty type. Rust can handle errors using enums (sumtypes) with the Result type.
  • Testing
    ThePrimeagen briefly walks through the unit testing organization and example code for TypeScript, Go, and Rust. Unit testing with Rust happens in the file and can test private interfaces.

Submarine Navigation

Section Duration: 38 minutes

Fissures

Section Duration: 47 minutes

Count Trees

Section Duration: 26 minutes

CLI

Section Duration: 44 minutes

Projector Object

Section Duration: 1 hour, 5 minutes

Testing

Section Duration: 44 minutes
  • Testing in TypeScript
    ThePrimeagen demonstrates how to create and run tests in TypeScript and what a thrown error looks like. Suggestions for the amount of testing that should be done on a project are also provided in this segment.
  • Testing in Go
    ThePrimeagen walks through testing the projector project in Go with the built-in testing package and test command. A student's question regarding the phrase "black box testing" is also covered in this segment.
  • Testing in Rust
    ThePrimeagen demonstrates testing the projector project using Rust. Rust provides features specifically for writing tests, including the test attribute, a few macros, and the should_panic attribute.
  • Testing Q&A
    ThePrimeagen answers student questions regarding if Rust files can get large due to the tests being included and if naming the functions starting with test_ is just a convention. Questions regarding whether only the macro test is relevant for running tests and the trade-offs of having in-file tests are also covered in this segment.

Projector

Section Duration: 2 hours, 52 minutes

Wrapping Up

Section Duration: 2 minutes
Same CLI tool implemented in TypeScript, Go and Rust for comparison.
Andy

Andy

_andys8

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