Introduction

Completed

Object-oriented programming (OOP) is a popular programming paradigm that most programming languages support, at least partially. Go is one of these languages, though it doesn't fully support all the OOP principles.

At this point in your learning path, you've covered enough ground that you're ready to learn about and implement principles such as encapsulation and composition.

This module covers how interfaces work in Go and why they differ between Go and other programming languages. Interfaces in Go are implicit and, in this module, you'll see how this works.

This module also covers methods and why you use them in Go.

Learning objectives

In this module, you'll learn about:

  • How Go implements OOP principles such as encapsulation and composition.
  • How to write methods and why you use them.
  • How to write embedding and overloading methods.
  • How to write and use interfaces, and why they differ from interfaces in other programming languages.

Prerequisites

  • A Go environment that's ready to create applications. Ideally, you've installed and configured Go and Visual Studio Code with the Go extension.
  • Ability to create and modify .go files.
  • Ability to run Go applications by using the terminal prompt.
  • Knowledge of basic data types such as string, int, and boolean.
  • Knowledge of writing basic data control flows such as if and for statements.
  • Knowledge of writing functions.
  • Knowledge of creating structs.