Working with Design Patterns in Go (Golang)

Working with Design Patterns in Go (Golang)

English | MP4 | AVC 1920×1080 | AAC 44KHz 2ch | 113 lectures (10h 18m) | 4.57 GB

Streamline your development by learning how common design patterns are implement in Go.

Go is a powerful language for building efficient and scalable applications. But as your projects grow, you’ll encounter common problems that can be elegantly solved with design patterns.

This course will equip you with the knowledge and skills to leverage these design patterns effectively in your Go code. We’ll explore various categories of patterns, including:

  • Creational Patterns: Learn techniques for object creation that promote flexibility and decoupling.
  • Structural Patterns: Discover ways to compose classes and objects to achieve desired functionality.
  • Behavioral Patterns: Explore patterns that define communication and interaction between objects.

By understanding these patterns, you’ll gain the ability to:

  • Write cleaner, more maintainable, and reusable code.
  • Improve the design and architecture of your Go applications.
  • Solve common programming challenges with proven solutions.
  • Communicate design concepts more effectively with other developers.

We’ll approach design patterns with a practical lens, focusing on real-world Go scenarios. In fact, we’ll build a simple web application that allows us to see how, why, and when you can use a particular design pattern to make your code more efficient, maintainable, and easy to understand. My goal is ensure that you’ll gain hands-on experience implementing these patterns so that you can use them in your own projects.

So, whether you’re a seasoned Go developer or just getting started with the language, this course will provide you with valuable tools to take your Go development skills to the next level.

What you’ll learn

  • How to use common design patterns in Go
  • Streamline the software development process by using well known patterns
  • Learn how to create loosely coupled software components
  • Build a real-world application using design patterns
Table of Contents

Introduction
1 Introduction
2 A bit about me
3 Installing Go
4 Installing an Integrated Development Environment
5 Installing Docker
6 Asking for Help
7 Mistakes We all make them

Setting up a Simple Web Application
8 What well build in this section
9 How web applications work
10 Setting up our main application
11 Installing a routing package
12 Setting up routes
13 Setting up a simple HTML template
14 Creating a render function
15 Rendering our first page
16 Adding navigation
17 Creating templates for all site pages
18 Setting up a route handler for site pages
19 Trying out our template cache
20 Adding WebP and jpeg images to the home page

Factory Patterns
21 What well build in this section
22 The Factory Pattern
23 Setting up some types
24 Creating a simple Factory
25 Creating handlers for the simple Factory
26 Setting up the front end
27 Adding routes for our Factory handlers
28 Trying our Factory pattern out
29 The Abstract Factory pattern
30 Creating an Abstract Factory
31 Creating a route and handler for the Abstract Factory
32 Updating the front end
33 Trying out our Abstract Factory

Connecting to a Database
34 What well build in this section
35 Adding a module to support MySQLMariaDB
36 Setting up a local MariaDB instance with Docker
37 Connecting our application to MariaDB

The Repository Pattern
38 What well build in this section
39 Writing our first database function
40 Creating a handler to list dog breeds
41 Updating the front end to fetch the list of dog breeds
42 Updating the front end to display the list of dog breeds
43 Writing a test for our handler
44 Implementing the Repository pattern I
45 Implementing the Repository pattern II
46 Implementing the Repository pattern III
47 Trying things out
48 Implementing a test database repository
49 Updating our handler test

The Singleton Pattern
50 What well build in this section
51 Creating a simple Singleton
52 Updating our project to use our configuration package singleton

Builder Pattern Fluent Interface
53 What well build in this section
54 The Builder Pattern Fluent Interface
55 Getting started with the Builder pattern in our project
56 Setting up our Builder code
57 Fixing three problems with our Builder code
58 Setting up a handler to use our Builder pattern
59 Setting up a route to our handler
60 Modifying the front end to call our Builder route
61 Challenge
62 Solution to challenge

Adapter Pattern
63 What well cover in this section
64 The Adapter Pattern Overview
65 Installing an application to serve JSON and XML
66 Setting up the Adapter type the Adaptee
67 Adding the Adapter to our application config
68 Setting up a handler
69 Adding a route
70 Updating the Cat Breeds template
71 Switching adapters from JSON to XML
72 Adding a test for the Cat Breeds handler using our adapter pattern

Bringing it all together
73 What well cover in this section
74 Creating a stub AnimalFromAbstractFactory handler
75 Creating a New factory function for pet with embedded breed
76 Creating stub newPetWithBreed method for Cats and Dogs
77 Adding a GetDogBreedByName method in the database Repository
78 Refactoring adaptersgo to new package
79 Adding a GetCatBreedByName method on our JSON adapter
80 Adding a GetCatBreedByName method on our XML adapter
81 Finishing up the new Adapter and Abstract Factory code
82 Finishing up the changes in our Abstract Factory to use the new adapters
83 Setting up a route to our stub handler
84 Finishing off the handler code
85 Updating the front end to try things out
86 Writing the necessary javascript to call our back end

The Decorator Pattern
87 What well cover in this section
88 Setting up a route and a stub handler
89 Setting up the database table
90 Adding database methods for Dog of Month
91 Completing our DogOfMonth handler
92 Creating the Dog of Month template and trying things out

The Worker Pool Pattern
93 What well cover in this section
94 Worker Pool Overview
95 Setting up a Go Workspace to develop our new module
96 Getting started with the App and Streamer projects
97 Creating a Factory function for our Worker Pool
98 Getting started on the worker pool functionality
99 Setting up the Processor type
100 Setting up the Pool functionality
101 Creating Videos to send to the worker pool
102 Sending videos to the worker pool
103 Filling in the encode functions logic
104 Trying things out and tracing through program execution
105 Installing ffmpeg
106 Adding logic to encode to MP4
107 Trying out the EncodeToMP4 method
108 Adding logic to encode to HLS Part One
109 Adding logic to encode to HLS Part Two
110 Trying out our HLS encoder
111 Adding random filename generation to our videos
112 Trying out our worker pool with four videos
113 Adding streamer to our Breeders project

Homepage