Getting Started with Go: Functions & Object Orientation

Go    |    Beginner
  • 12 videos | 1h 7m 18s
  • Includes Assessment
  • Earns a Badge
Rating 4.6 of 60 users Rating 4.6 of 60 users (60)
Go is a statically-typed, multi-paradigm programming language supporting functional and procedural programming, and while Go is not an object oriented programming language out of the box, it does provide types and methods that can conveniently be used to emulate object oriented programming. In this course, you'll explore how to define and write functions and you'll learn how functions can be declared with receivers to create methods in Go. You'll explore how pointers and pointer variables are used in Go and you'll learn how to experiment with structs as objects and interfaces that explicitly define the relationship between objects. You'll explore how data types in Go can have state and behavior associated with them, and lastly, you'll explore how a lightweight form of object orientation is achieved in Go.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Recognize how functions and methods are created and used in go
    Recognize how object orientation can be achieved in go even though it is not strictly an object oriented language
    Declare and write functions in go
    Use parameters to pass data to functions in go
    Work with data returned by functions in go
  • Declare and call variadic functions in go
    Define and initialize structs in go
    Create and work with methods in go
    Implement an interface in go to define a method set
    Create a structured data type as an object in go with methods that can interact with it
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 1m 39s
    In this video, you’ll learn more about the course and your instructor. In this course, you’ll learn to define and write functions. You’ll also learn how functions can be declared with receivers to create methods in Go. You’ll explore how pointers and pointer variables are used in Go. You’ll experiment with structs as objects and interfaces that define relationships between objects. You’ll explore how data types in Go have state and behavior associated with them. FREE ACCESS
  • 5m 52s
    In this video, you’ll learn more about functions and methods in Go. A function is a set of code that takes zero or more inputs and produces zero or more outputs. These are important in software programs because by writing functions, you can break up programs into smaller chunks, making them more manageable. Typically, functions are written to solve very generalized problems and are designed to be called over and over. FREE ACCESS
  • Locked
    3.  Object Orientation in Go
    6m 48s
    In this video, you’ll learn more about how object orientation can be achieved in Go, even though it’s not an object-oriented programming language. In object-oriented programming, you have the concept of objects and data types that have state and behavior. State, in this case, is the data and behavior is the code. While Go doesn’t have an object type, it has the struct type. The struct type has named fields as attributes of an object. FREE ACCESS
  • Locked
    4.  Declaring and Writing Functions in Go
    5m 36s
    In this video, you’ll watch a demo. You’ll learn to declare and write functions in Go. To start, open Visual Studio Code. On the Visual Studio Code main page, you’ll open a folder in the Visual Studio Code explorer by typing Ctrl+K, and then Ctrl+O. That opens an Open Folder dialog. You’ll open your projects/demo folder, and choose Select Folder. Close the Welcome screen. In Explorer, go to your demo folder and select New File. FREE ACCESS
  • Locked
    5.  Passing Parameters to Functions in Go
    10m 45s
    In this video, you’ll watch a demo. In this demo, you’ll pass parameters to functions. Sometimes when calling a function, you need to pass data to the function. On your local development machine, open Visual Studio Code. In Visual Studio Code Explorer, select the New File icon, and name this file main.go. In your editing canvas, you’ll start typing package. From the options, select pkgm package main and main function to create the code. FREE ACCESS
  • Locked
    6.  Returning Data from Functions in Go
    5m 50s
    In this video, you’ll watch a demo. In this demo, you’ll work with data being returned from functions. A function's signature includes the result declaration. This specifies the return values are if there are any in the function. You’ll open Visual Studio Code. In Visual Studio Code Explorer, select the New File icon, and name this new file main.go. In the main editing canvas, start typing package, and select package main and main function. FREE ACCESS
  • Locked
    7.  Working With Variadic Functions in Go
    6m 31s
    In this video, you’ll watch a demo. To get started, you’ll open Visual Studio Code. In Visual Studio Code Explorer, select New File and create a new file. Call it main.go. The last parameter of a function signature may have a type prefixed with three dots. This is called the pack operator. The pack operator is used when you declare variadic functions because the arguments are packed into a slice when passed to the function. FREE ACCESS
  • Locked
    8.  Defining and Initializing Structs in Go
    8m 53s
    In this video, you’ll watch a demo. In this demo, you’ll define and initialize a struct. You’ll first open Visual Studio Code and in Visual Studio Code Explorer, you’ll select the New File icon. Next, you’ll create a new file called file main.go. In the editing canvas, set up a package by typing pk. Then select pkgm, package main and main function. Go will create the code for you. FREE ACCESS
  • Locked
    9.  Declaring and Writing Methods in Go
    4m 31s
    In this video, you’ll watch a demo. In this demo, you’ll create and write a method. You’ll open Visual Studio Code. In Visual Studio Code Explorer, select the New File icon. Name this file main.go. In the editing canvas, type pk to bring up a context menu with options the Go extension provides. Press Enter to select pkgm. This creates the package main and main function. Place your cursor at the start of line 3. FREE ACCESS
  • Locked
    10.  Working with Interfaces in Go
    5m 11s
    In this video, you’ll watch a demo. In this demo, you’ll implement an interface in Go. You’ll open Visual Studio Code. In Visual Studio Code Explorer, select the New File icon, and name the new file main.go. In the editing canvas, press Ctrl+V and paste in your code. On line 1 package main, and in your import block, you’ll import the format that’s on line 3. Line 5 is where you’ll define your interface. FREE ACCESS
  • Locked
    11.  Creating and Interacting with Objects in Go
    4m 46s
    In this video, you’ll watch a demo. In this demo, you’ll create and work with objects in Go. You’ll open Visual Studio Code. In Visual Studio Code Explorer, select the New File icon. Give the new file the name main.go. In the editing canvas, press Ctrl+V to paste in the code.  In the import block, you’ll import the format package. On line 7, you’ll define an interface. This interface is named Shape. FREE ACCESS
  • Locked
    12.  Course Summary
    56s
    In this video, you’ll summarize what you’ve learned in this course. You’ve examined how functions and methods are implemented and how object orientation is achieved in Go. You explored functions and methods in Go by declaring, writing, and using parameters and returned data with functions. You worked with variadic functions and defined and initialized structs. You also declared and wrote methods, implemented interfaces, and explored how to use data types and methods. FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 4.5 of 53 users Rating 4.5 of 53 users (53)
Rating 4.6 of 274 users Rating 4.6 of 274 users (274)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.7 of 31 users Rating 4.7 of 31 users (31)
Rating 4.6 of 80 users Rating 4.6 of 80 users (80)
Rating 4.6 of 1395 users Rating 4.6 of 1395 users (1395)