Skip to content

Instantly share code, notes, and snippets.

@migue
Created August 28, 2020 10:34
Show Gist options
  • Save migue/c8c70ca9449ac0a988624a5247405499 to your computer and use it in GitHub Desktop.
Save migue/c8c70ca9449ac0a988624a5247405499 to your computer and use it in GitHub Desktop.
Syllabus for an introductory course to programming in Go I will be teaching next winter

Programming in Go: an introduction

A short course to introduce my students to the Go programming language.

I try to provide my students with a comprehensive, and idiomatic view of the Go programming language, focusing on different topics ranging from language syntax, design, and good practices to concurrency, testing or profiling.

Chapter one: Syntax and data structures

This chapter will try to cover the basic concepts and syntax of the language:

Variables

Structs

Pointers

Arrays and slices

Error handling

Chapter Two: abstracting our programs

We will talk about different concepts that will help us to properly design our programs:

Interfaces and methods

Embedding and exporting

Decoupling

Design guidelines

Chapter Three: Goroutines

We will go through the main concepts of goroutines, what they are, their benefits, and how to use them. Additionally, we will talk about the mechanics of the OS scheduler and the Go Runtime scheduler

Chapter Four: Channels

This chapter will help us to understand what channels are and how to properly use them. We will also analyze some commonly used patterns:

Basic waiting patterns

Cancellation pattern

Fan out pattern

Chapter Five: Testing and benchmarking

This chapter will provide the foundations to get started with basic unit testing, table unit testing, code coverage, and benchmarking practices

Chapter Six: Profiling and tracing?

I am not sure if I should include this chapter. My original idea is to provide the students with the basic concepts of how profiling and tracing works, the available tools and use all of it in a couple of examples trying to perform some optimization on a existing application.

@jrhrmsll
Copy link

Hi,

After reading the syllabus and reviewing it, I will let some suggestions:

Chapter One

  • Maybe is convenient start with "Basic Data Types" instead of "Variables" enforcing the typed nature of the language from the beginning.
  • Some "Composites Data Types" are mentioned but Maps is missing.
  • Is better to move structs after basic data types and the others composites ones like arrays, slices and maps. This bring the opportunity to introduce json because its coupling with structs, and pave the way for functions.

Functions could be treated here or move to the second chapter, some topics to treat:

  • errors(mentioned), panic and recover
  • function values
  • defer (one of the Go unique features)

Chapter Six
Profiling is very useful an easy to include in any Go program with pprof. Tracing is more related to distributed systems and micro services.
In my opinion logging and monitoring are more valuable here to complement profiling. That is not means letting out tracing but some basic insights could be get out of the box using sidecars (envoy).

Apart from that, the overall distribution is good. I find the book "The Go Programming Language" from Alan A. A. Donovan · Brian W. Kernighan very valuable. In the book's site the "Contents" is available as PDF, maybe you will find it helpful too.

Best regards,

@migue
Copy link
Author

migue commented Sep 4, 2020

Thanks a lot for your comments and the ideas, I will take them into account.

The book is nice, I have read it and I have already borrowed some of the ideas from their table of contents :D

Regarding the tracing, I wasn't thinking about distributed tracing but the trace tool which can be used to trace the runtime (scheduler, garbage collector, ...)

Again, thanks a lot for your comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment