June 12, 2019

Golang study levels

I'd like to discuss a way to assess the skill of a Go developer (myself included) by setting three broad study categories. Note that, assessing one's skill to be parcel of one category versus another is not intended to be an assessment on one's skill as a programmer. The simple purpose of what follows is to give the programmer an idea of what she needs to pay attention to in continuing to grow.

Beginner

At this stage, the Go programmer needs to learn how to setup her workstation. She needs to learn where to look for guidance, and she needs to start learning the basic features of the language. In my opinion, the most important features are:

  • the hello.go program, and how it demonstrates the concepts of packages, main functions, function syntax in general
  • the basic data types
  • how to fetch other packages and import them into her program

For reference, hello.go usually looks something like this:

package main

import "fmt"

func main() {
  fmt.Println("hello Go!")
}

and running it goes like so:

$ go run hello.go
hello Go!

Intermediate

As the Go programmer progresses, she needs to get comfortable with managing dependencies, navigating documentation, testing, and interface design.

For example, Go modules provide a clean way to manage dependencies:

$ go mod init gitlab.com/1ijk/study
$ go mod tidy

The tidy command above ensures that imports declared in .go files have been referenced in the resulting dependency list for your package – there's more to it, but that suffices for an example of what needs learning.

Interface design presents an interesting opportunity to abstract one's code, both making it more compatible with other packages and easier to test. Fo reference, here's what an interface looks like:

type Stringer interface {
  String() string
}

Basically, this says that any struct that implements the string method satisfies the Stringer interface. Huh? Here's an example of implementing the Stringer interface:

type Example struct {
  Data []byte
}


func (this Example) String() string {
  return fmt.Sprintf("this Example Data: %s", string(this.Data))
}

The reason I place interfaces in the intermediate level is that it often relies on understanding the basics of package imports and usage, data types, function type declaration, and a general conception of Object Oriented Programming. Not difficult per se, but just a bit of background that needs minding.

Personally, I place my skill level at intermediate; I need to get better with interface design.

Advanced

This section is difficult for me to write, since it means stating a number of skills that I don't currently possess. I'll laundry list it for now – consider it an additional list of things I do not know, but want to learn.

  • code generation
  • appropriate channel usage
  • cross-compiling for embedded platforms
  • comprehensive integration testing
  • using unsafe safely and sanely

Eventually, I may get to this level; the idea of this list, however, is that these are skills that have much rarer applicability and so don't arise often.

(Some may argue that chan should be considered more fundamental here. It's true that chan is fundamental to the language, yet I caution against becoming over-zealous with that feature as it can lead to obfuscation and poor runtime performance.)

Content by © Jared Davis 2019
Theme by © Emir Ribic 2017

Powered by Hugo & Kiss.