Go: Data Structures, Algorithms and Design Patterns with Go
4.0 (35 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
320 students enrolled

Go: Data Structures, Algorithms and Design Patterns with Go

Delve into Go's powerful data structure, algorithms, classical design patterns by using TDD with some easy tricks
4.0 (35 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
320 students enrolled
Created by Packt Publishing
Last updated 4/2019
English
English [Auto]
Current price: $139.99 Original price: $199.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 10 hours on-demand video
  • 1 downloadable resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • This course is aimed at beginner-level developers in the Go programming language, who would like to learn data structures and algorithms in Golang.
Course content
Expand all 60 lectures 10:06:45
+ Learning Go Data Structures and Algorithms
17 lectures 02:28:40

This video provides an overview of the entire course.                        

Preview 03:19

We would go through some basic and installation aspects of Go programming language.                         

  • Introduction

  • Installation 

Basics of Go
02:00

We would start with actually programming.                         

  • Understand how Go programming works

  • Write a Hello World Program 

Writing a Hello World Program
07:32

Importance of variables and how to define them?                         

  • What are variables?

  • Declaration

  • Numbers, string, Boolean types

Variables and Elementary Types
03:43

The importance of functions.                         

  • What are functions?

  • Arguments and Values

Applying Functions
05:51

Discussion of functions.                         

  • Analyze variables

  • Direction oriented

Forming Control Structures
08:18

Discussion about various data structures.                         

  • Understand Slices

  • Understand Maps

Data Structures - Array, Slices, and Maps
11:05

Discussion about structs and methods.                         

  • What are structs?

  • What are methods?

  • How to define and call them

Structs and Methods
10:06

In this video, we would discuss how to deal with failures.                         

  • Handling

  • Emitting error values

Error Handling
09:22

This deals mostly with linked list.                         

  • Start with single linked list

  • Modify single to double linked list

Single and Double Linked Lists
12:33

Stack is one of the most common yet powerful data structure.                         

  • Push operation

  • Pull operation

Implementing Stacks
08:23

Understand the various aspects of queue.                         

  • What is Queue?

  • Implement Channels

Implementing Queue (Alternative Channel Implementation)
10:14

Importance of binary trees.                         

  • What is a binary tree?

  • Recursive functions

Binary Search and Trees
14:38

This part would lay the foundation of concurrency model.                         

  • Fundamentals of GoLine concurrency model

  • Go Routines and channels

Generating Channels
05:06

In this part we would improve our common programming skills.                         

  • Fan in

  • Fan out

Multiplex and Demultiplex with Fan In/Out
13:21

We would understand the benefits of a model in which m number of workers work their way through n tasks in a work.                         

  • What is a Worker pool?

Implementing Worker Pools
07:13

In the final part we will build a search engine.                         

  • How to build a distributed search engine?

Building a (Tiny) Distributed Search Engine
15:56
+ Introduction to Go Classical Patterns
22 lectures 03:32:18

This video introduces the course and gives a quick look at where you’ll be at the end of the course. 

Preview 04:24

The most important task to do when starting with a new programming  language is to set the work environment. This video will show you how  to do this for Go.           

  • Learn to install Go on different operating systems 

Installing Go
08:22

This video will show you how to write your first program in Go and walk you through some basic data types in Go language.           

  • Write a simple program to display “Hello World”

  • Learn about Integrated Development Environment (IDE)

  • Learn about types, variables, and constants in Go

Starting with Hello World
06:18

The basic logic for good programs are conditional statements.  Let’s get started with the most used conditional statements with this  video.           

  • Using the if else statement

  • Using the switch statement

  • Using the for range statement 

Flow Control
04:40

In Go, whatever you design is used through functions. Let’s see how functions work and are used in Go.           

  • Understanding a function

  • Create, handle and return errors

  • Explore functions with undetermined number of parameters

Functions
06:43

This video will show you how data structures are manipulated and used in Go.           

  • Use arrays, slices and maps 

  • Learn to use the visibility attribute of a function

Arrays, Slices, and Maps
08:18

The next step, after exploring functions and data structures, is  to learn about the most useful elements of Go, which are pointers,  structures and interfaces. Let’s jump right in to start with these.           

  • Declare pointers

  • Use and print the values from a pointer

  • Declare and use structures;  at the end we will explore interfaces

  • Explore interfaces

Pointers, Structures, and Interfaces
10:59

When you write a small piece of code, it is easy to spot bugs. But  what if the program or application grows bigger and bigger? Let’s see  how you could write unit tests to spot errors and catch bugs.           

  • Learn about testing package

  • Learn about TDD

Testing and TDD
06:46

Until now, you have learned to develop codes for applications. How  can you create libraries which are not applications or which do not  contain the main function? This video is an answer to this question.           

  • Learn about the go get tool

  • Learn about the encoding package

Libraries
08:53

Go comes with a series of useful tools to ease the development  process every day. Let’s explore these amazing tools with this video.           

  • Learn to use golint and gofmt tools

  • Contribute to Go open source projects in GitHub

Go Tools
07:08

How can you have a unique instance of a type in the entire  program? Singleton design pattern is the way to achieve this. Let’s  learn about this pattern. 

  • Write a counter that holds the number of times it has been called during program execution

Singleton Design Pattern
11:04

How can you construct complex objects without directly  instantiating their struct or writing the logic they require? Let’s do  this with the builder design pattern.           

  • Create a vehicle builder

  • Write the implementation

Builder Design Pattern
12:10

How can we abstract the user from the knowledge of the struct he  needs to achieve for a specific purpose, such as retrieving some value,  maybe from a web service or a database? This video will help you answer  this question. 

  • Implement a payments method Factory

  • Create an interface with the Pay method

Factory Method
10:27

After learning about the factory design pattern, where we grouped a  family of related objects in our case payment methods, one can be quick  to think: what if I group families of objects in a more structured  hierarchy of families? This video will answer your question.   

  • Reuse the Factory created in the Builder design pattern

  • Create a new Factory to create shipment orders

Abstract Factory
07:58

Let’s see the last pattern with this video, which comes in handy  when creating objects and is commonly surrounded by more patterns.

  • Build a small component of an imaginary customized shirts shop

  • Create the Stock Keeping Unit (SKU) 

Prototype Design Pattern
07:46

This video will walk you through the different approaches to  create hierarchies and trees of objects using the composite design  pattern.

  • Create compositions along with binary tree compositions

  • Solve the swimmer and fish problem using direct composition

Composite Design Pattern
12:15

How can you use something that wasn't built for a specific task at  the beginning? Let’s answer this question with the adapter design  pattern.

  • Use an incompatible interface with an adapter object

  • Unit-test the printer adapter

  • Implement the adapter design pattern

Adapter Design Pattern
06:39

Let’s learn to decouple abstraction from its implementation and  change what an object does as much as we want. This video will show you  how you can change the abstracted object while reusing the same  implementation.

  • Write to an io.Writer interface

  • Write two abstracted object users of the implementations

Bridge Design Pettern
16:42

Let’s dive into the Proxy design pattern; it provides interesting features and possibilities with very little effort.

  • Create a remote proxy to be a cache of objects before accessing a database

 

Proxy Design Pattern
13:56

This video will walk you through the methods and practices to provide a lot of benefits when working with legacy code.

  • Prepare a Pizza type

  • Create the pizza as core and the ingredients as decorating types

  • Write the implementation and Run the test

Decorator Design Pattern
12:58

This video will show you how you can hide the rooms and corridors  of a building. By the end of this video, you will be able to shield the  code from unwanted access, order some calls, and hide the complexity  scope from the user.           

  • Write your own library that accesses OpenWeatherMaps service

  • Write the Unit test and create the implementation

Facade Design Pattern
13:45

This video will show you how to allow sharing the state of a heavy  object between many instances of some type. You will explore a very  commonly used design pattern, in computer graphics and the video game  industry.

  • Simulate things that you find on betting web pages

  • Store each team's information just once

  • Deliver references to them to the users 

Flyweight Design Pattern
14:07
Test Your Knowledge
5 questions
+ Go Behavioral Patterns
11 lectures 02:41:20

This video will walk you through the most important design pattern in object-oriented programming, with which many design patterns have something in common.

  • Paint objects on a file

  • Provide a way to show to the user an object in text or image


 

Strategy Design Pattern
27:12

Through this video, you will learn to build chains of objects that can decide which between them must deal with a particular case.

  • Develop a multi-logger solution

  • Use two different console loggers and one general-purpose logger


 

Chain of Responsibility Pattern
17:05

This video will show you how to encapsulate actions that don’t necessarily need to be executed immediately or must be stored.

  • Create a simple queue

  • Create many instances of a type implementing a command pattern

  • Pass these instances to a queue that will store the commands until three of them are in the queue


 

Command Design Pattern
14:22

How could you provide a user some way to execute code within an algorithm? This video will let you answer this question. You will be able to write idiomatic Go Template patterns.

  • Write an algorithm that is composed of three steps

  • Make each step return a message

  • Let the first and third steps be controlled by the template, and the second by the user


 

Template Design Pattern
17:49

This video will show you how you could save milestones of a state when you have a type with some state. You will learn to recover them if necessary for a variety of tasks: undo operations, historic, and so on.

  • Develop a simple example using a string as the state

  • Store a finite amount of states of type string

  • Restore the current stored state to one of the state list


 

Memento Design Pattern
17:18

This video will let you dig into a quite complex pattern, which is widely used to solve business cases where it's useful to have a language to perform common operations.

  • Create a reverse Polish notation calculator


 

Interpreter Design Pattern
14:19

What if you want to abstract away some functionality from a set of objects? Let’s do it through this video.

  • Delegate some logic of an object's type to an external type

  • Emulate an online shop with a few products


 

Visitor Design Pattern
15:55

You may require something that has one or more states and travels between them to execute some behaviors. These are termed as FSMs. Let's see how the State pattern helps us to define FSM.

  • Develop a very simple game that uses FSM

  • Create a type that alters its own behavior when some internal things have changed

  • Add more states and reroute their output states

 

State Design Pattern
11:38

How do we avoid tight coupling between objects?

  • Define an operation called Sum that takes a number and adds it to another number.

  • Define an operation called Subtract that takes a number and substracts it to another number

  • Develop an extremely simple arithmetic calculator


Mediator Design Pattern
07:15

How can you uncouple an event from its possible handler? How can you achieve many actions that are triggered on one event? Let’s answer these questions with this video.

  • Create a publisher with a NotifyObservers method

  • Create a method to add new subscribers to the publisher

  • Create a method to remove new subscribers from the publisher

 

Observer Design Pattern
13:34
Test Your Knowledge
5 questions
+ Go Concurrency
10 lectures 01:24:27

This video gives you a quick glimpse of what all we will be exploring through this course.


 

Preview 03:29

Often concurrency is misunderstood as parallelism. This video gives you a clear definition and shows you the true essence of concurrent design patterns.

  • Get introduced to Concurrency

  • Compare concurrency with parallelism

Defining Concurrency
05:00

How do we achieve concurrency in Go? This video is an answer to this question. Let’s get started with our first concurrent program.

  • Create the first Goroutine

  • Use an anonymous function and launch it in a new Goroutine using the go keyword

  • Use WaitGroup to synchronize Goroutine

Goroutines
09:26

How can you write an anonymous function that executes within the context of a different function? Let’s do it with this video.

  • Write a function to convert a string to uppercase

  • Use the synchronous and asynchronous call backs within our routines

  • Handle the Callback hell

Callbacks
04:45

If you are working with concurrent applications, you have to deal with more than oneresource potentially accessing some memory location. How do we deal with this condition? Let’s learn through this video.

  • Develop a small concurrent counter

  • Add 1 to an integer field in a Counter type

  • Make the detector of the -race flag warn of a possible race condition

Mutexes
07:24

This video will walk you through the usage of channels that allow you to write concurrent applications. You could share a memory location and get a natural way to handle concurrent applications.

  • Understand how channels work and learn to use them

  • Use buffered channels and directional channels

  • Use the select statement

Channels
14:07

It’s time put all our knowledge about Goroutines and channels in asingle package. Let’s do it right now with this video.

  • Create a concurrent counter

  • Use three channels, the first one to add 1

  • Use the second channel to get thecurrent count and the third to stop the Goroutine

Using It all – Concurrent Singleton
08:57

In this video, we will put up a barrier so that nobody passes till we have all our results using the Barrier pattern. It is very important in concurrency patterns.

  • Create unit test with the function barrier

  • Implement the unit test using correct and incorrect inputs

Barrier Concurrency Pattern
10:51

For asynchronous programming, we require Future pattern to achieve concurrent patterns. In this video, we will develop features.

  • Create unit test using the success and fail functions

  • Execute the tests in a uncontrollable and controllable way

  • Perform the closure test

Future Design Pattern
11:27

To build complex synchronous structures linked to one another, we require the Pipeline design pattern. It is one of the most important concurrent patterns.

  • Create unit test

  • Generate list and raise numbers to the power 2 and return the sum

  • Launch pipeline

Pipeline Design Pattern
09:01
Test Your Knowledge
4 questions
Requirements
  • Prior knowledge of basic Go programming would be advantageous.
Description

Go is a multi-paradigm programming language that has built-in facilities to create concurrent applications. Design Patterns will provide readers with a reference point to software design patterns and CSP concurrency design patterns to help them build applications in a more idiomatic, robust, and convenient way in Go.

With this hands-on, practical course, you'll first have a deep dive into understanding the basic data types, structures, linked lists and doubly linked lists in Go. Then, you will learn about graph algorithms such as binary & trees. You will then learn about CSP concurrency patterns used to maintain thousands of servers. Moving further, you will also gain advanced knowledge about classic design patterns to build concise, readable, and maintainable applications & software.

Finally, you will learn concurrent structures and parallel execution which helps you improve your concepts of Go Concurrency to write concurrent apps & develop some classical design patterns with concurrent structures to maximize parallelism.

Contents and Overview

This training program includes 2 complete courses, carefully chosen to give you the most comprehensive training possible.

The first course, Learning Go Data Structures, and Algorithms will begin by understanding the basic Data types and Structures in Go. Moving forward, you will learn the power of linked lists and doubly linked lists in Go and then learn to implement linear data structures such as stacks and queues. Also, implement binary searches and trees and will explore sorting algorithms in detail. From here, you will learn about graph algorithms and also be introduced to some common data structures used while working with strings. You will learn common techniques and structures used in tasks such as preprocessing, modelling, and transforming data. By the end of this course, you would have mastered functional and reactive implementations of traditional data structures in an easy and efficient manner

The second course, Introduction to Go Classical Patterns starts with a brief introduction to Go programming essentials and quickly moves on to explain the idea behind the creation of design patterns and how they appeared in the 90’s as a common "language" between developers to solve common tasks in object-oriented programming languages. You will then learn how to apply the 23 Gang of Four (GoF) design patterns in Go and also learn about CSP concurrency patterns, the "killer feature" in Go that has helped Google develop software to maintain thousands of servers. With all of this, the book will enable you to understand and apply design patterns in an idiomatic way that will produce concise, readable, and maintainable software.

The third course, Go Behavioural Patterns will take you to an advanced level of knowledge about classic design patterns but, as you will see, the design patterns covered here are quite different, partly because of the lack of inheritance in Go, but also because we have different and more optimal ways to solve the same problems. With all this, the course will enable you to understand and apply design patterns in an idiomatic way that will produce concise, readable, and maintainable software.

The fourth course, Go Concurrency is on learning about concurrent structures and parallel execution. You will use the majority of Go primitives to write concurrent apps, and we will develop some classical design patterns with concurrent structures to maximize parallelism. Also, you will learn some typical structures with which to develop concurrent apps in Go. You will learn how a classical pattern can become more complex if you need it to work in a concurrent way; however, the idea is to understand Go concurrent primitives so that you know how to write your own concurrent design patterns by using the knowledge taken from the course.

About the Authors:    

Gustavo is an experienced software developer and has been writing code since the beginning of the century. He has vast experience working with different languages, including Erlang, JavaScript, and C but with a major interest in Go. He is currently a Technical Leader of a Golang team that builds distributed systems. When he is not coding, you can find him cycling, rock-climbing, and playing guitar in his free time.

Mario Castro Contreras is a software engineer who has specialized in distributed systems and big data solutions. He works as a site reliability engineer, and now he is focused on containerized solutions and apps using most of the Google Cloud suite, especially, Kubernetes. He has wide experience in systems and solutions integration, and he has written many scalable and reliable 12-factor apps using Go and Docker. He has designed big data architectures for financial services and the media, and he has written data processing pipelines using event-driven architectures entirely in Go. He is also very active in the open source community, and you can find him on his GitHub account with the username sayden. In the past, he has also written mobile applications and backends in Java. Mario is passionate about programming languages, and he finds the best balance between fun and productivity in Go; however, recently he enjoys writing in Rust and embedded systems in C. He is also passionate about road cycling and winter sports.

Who this course is for:
  • Understanding the basics to get started with Golang
  • Implementing stacks and queues & data structure
  • Exploring different concurrency models for data processing
  • Build your own tiny distributed search engine
  • Encapsulate the creation of complex objects in an idiomatic way in Go
  • Create unique instances that cannot be duplicated within a program
  • Understand the importance of object encapsulation to provide clarity and maintainability
  • Learn most Go primitives and write concurrent apps
  • Develop some classical design patterns with concurrent structures to maximize parallelism