We may earn an affiliate commission when you visit our partners.
Course image
Udemy logo

Design Patterns in Go

Dmitri Nesteruk

Course Overview

This course provides a comprehensive overview of Design Patterns in Go from a practical perspective. This course in particular covers patterns with the use of:

Read more

Course Overview

This course provides a comprehensive overview of Design Patterns in Go from a practical perspective. This course in particular covers patterns with the use of:

  • The latest versions of the Go programming language

  • Use of modern programming libraries and frameworks

  • Use of modern developer tools such as JetBrains GoLand

  • Discussions of pattern variations and alternative approaches

This course provides an overview of all the Gang of Four (GoF) design patterns as outlined in their seminal book, together with modern-day variations, adjustments, discussions of intrinsic use of patterns in the language.

What are Design Patterns?

Design Patterns are reusable solutions to common programming problems. They were popularized with the 1994 book Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, John Vlissides, Ralph Johnson and Richard Helm (who are commonly known as a Gang of Four, hence the GoF acronym).

The original book GoF book used C++ and Smalltalk for its examples, but, since then, design patterns have been adapted to every programming language imaginable: C#, Java, Swift, Python, JavaScript and now — Go.

The appeal of design patterns is immortal: we see them in libraries, some of them are intrinsic in programming languages, and you probably use them on a daily basis even if you don't realize they are there.

What Patterns Does This Course Cover?

This course covers all the GoF design patterns. In fact, here's the full list of what is covered:

  • SOLID Design Principles: Single Responsibility Principle, Open-Closed Principle, Liskov Substitution Principle, Interface Segregation Principle and Dependency Inversion Principle

  • Creational Design Patterns: Builder, Factories (Factory Method and Abstract Factory), Prototype and Singleton

  • Structrural Design Patterns: Adapter, Bridge, Composite, Decorator, Façade, Flyweight and Proxy

  • Behavioral Design Patterns: Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method and Visitor

Who Is the Course For?

This course is for Go developers who want to see not just textbook examples of design patterns, but also the different variations and tricks that can be applied to implement design patterns in a modern way. For example, the use of the Composite pattern allows structures to be iterable and lets scalar objects masquerade as if they were collections.

Presentation Style

This course is presented as a (very large) series of live demonstrations being done in JetBrains GoLand and presented using the Kinetica rendering engine. Kinetica removes the visual clutter of the IDE, making you focus on code, which is rendered perfectly, whether you are watching the course on a big screen or a mobile phone. 

Most demos are single-file, so you can download the file attached to the lesson and run it in GoLand, or another IDE of your choice (or just run them from the command-line).

This course does not use UML class diagrams; all of demos are done via live coding.

Enroll now

What's inside

Learning objectives

  • Recognize and apply design patterns
  • Refactor existing designs to use design patterns
  • Reason about applicability and usability of design patterns

Syllabus

An introduction to the course

Welcome to the course!

Understand and apply the SOLID design principles

An overview of the SOLID design principles.

Read more

A look at the Single Responsibility Principle that states that a type (package) should have a single primary responsibility. Also discussed principles of Separation of Concerns and the God Object antipattern.

A look at the Open-Closed Principle that states that types should be open for extension, but closed for modification.

This principle is not particularly applicable to Go, but you can still make it work... sort of.

The Interface Segregation Principle is simple: don't put too much into your interfaces.

The Dependency Inversion Principle is a rather convoluted way of saying that you should depend on abstractions rather than implementation details.

A summary of the things we've learned about the SOLID design principles.

Learn about the Builder design pattern

An overview of the Builder design pattern.

Here we look at the builtin strings.Builder and construct our own HtmlBuilder.

Sometimes you need several builders to build up an object.

A look at how to coerce your users to use a Builder.

An alternative approach to implementing a Builder.

A summary of the things we've learned about the Builder design pattern.

Learn to create and use various Factory patterns

An overview of the Factory design pattern.

Go doesn't have constructors, but factory functions are a close equivalent.

A factory function that yields an interface rather than a concrete struct.

Manufacturing preconfigured libraries and storing them as variables. Can be done with a functional approach (function returning function) or a structural approach.

A generalized factory that can produce prepackaged objects.

A summary of the things we've learned about the Factory design patterns.

Learn to use the Prototype design pattern

An overview of the Prototype design pattern.

To implement Prototype, we need to master deep copying.

One approach to deep copying is to give your structs a method called DeepCopy().

Serialization makes deep copying easy!

Factory functions tailored to different prototypes make the Prototype pattern easy to use!

A summary of the things we've learned about the Prototype design pattern.

Learn about the much-maligned Singleton pattern

An overview of the much-maligned Singleton design pattern.

We implement a lazy, thread-safe singleton.

Direct dependencies on singletons are painful because they violate DIP and ruin testability.

Let's introduce abstractions and make our singleton more usable.

A summary of the Singleton design pattern. That wasn't so scary, was it?

Learn to use the Adapter design pattern

An overview of the Adapter design pattern.

A real-life example of an adapter.

Adapters can generate temporary data so here's how to avoid it.

A summary of the Adapter design pattern.

Learn about the Bridge design pattern

An overview of the Bridge design pattern.

Let's implement the Bridge design pattern!

A summary of the things we've learned about the Bridge design pattern.

Learn about the Composite design pattern

An overview of the Composite design pattern.

A demo of how the Composite pattern can be useful in a drawing application.

An implementation of Composite with neural networks.

A summary of the Composite design pattern.

Learn to implement the Decorator design pattern

An overview of the Decorator design pattern.

There's no 'multiple inheritance' in Go and multiple aggregation doesn't work that well, either.

A look at how to implement the Decorator pattern.

A summary of the Decorator design pattern.

Learn to use the Façade design pattern

An overview of the Façade design pattern.

A demo of how a Facade would be implemented.

A summary of the things we've learned about the Façade design pattern.

Learn to implement the Flyweight design pattern

An overview of the Flyweight design pattern.

An implementation of the Flyweight design pattern in the context of a text editor application.

Users often have similar first/last names. Flyweight can help us optimize memory usage.

A summary of the things we've learned about the Flyweight design pattern.

Learn to implement the Proxy design pattern

An overview of the Proxy design pattern.

A proxy that guards access to a resource.

A proxy that masquerades for an object that might not even be there.

The differences between the Proxy and Decorator design patterns.

A summary of what we've learned about the Proxy design pattern.

Learn to implement the Chain of Responsibility design pattern

An overview of the Chain of Responsibility design pattern.

A linked list of method invocations.

An important note before we implement an event broker.

A complicated CoR demo involving the Mediator and Observer design patterns as well as CQS.

A summary of the Chain of Responsibility design pattern.

Learn to use the Command design pattern

An overview of the Command design pattern.

Let's implement the Command design pattern!

Commands can also be made undo-able.

A merger of the Command and Composite design patterns.

If you don't need to preserve information about the command for future reference, you can wrap command as functions in a function slice.

A summary of the things we've learned about the Command design pattern.

Learn to implement the Interpreter design pattern

An overview of the Interpreter design pattern.

The first stage of interpretation is the lexing, which turns textual input into a sequence of tokens.

The second stage of interpretation is the parsing, which turns a sequence of tokens into an Abstract Syntax Tree (AST).

A summary of the things we've learned about the Interpreter design pattern.

Learn to implement the Iterator design pattern

An overview of the Iterator design pattern.

A look at the different ways structures can be made iterable.

An example iterator for tree traversal.

Learn to implement the Mediator design pattern

An overview of the Mediator design pattern.

Let's code the classic Mediator demo: a chat room!

A summary of the Mediator design pattern.

Learn to implement the Memento design pattern

An overview of the Memento design pattern.

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Guides students in recognizing and implementing advanced design patterns
Appropriate for Go developers with at least some programming experience
Covers all the Gang of Four (GoF) design patterns
Useful for developers who want to refactor existing designs to use design patterns
Geared toward developers who want to reason about applicability and usability of design patterns
Uses Kinetica rendering engine for visual demonstrations

Save this course

Save Design Patterns in Go to your list so you can find it easily later:
Save

Activities

Coming soon We're preparing activities for Design Patterns in Go. These are activities you can do either before, during, or after a course.

Career center

Learners who complete Design Patterns in Go will develop knowledge and skills that may be useful to these careers:
Software Engineer
The Design Patterns in Go course from [Website name] provides a comprehensive overview of design patterns in the Go programming language. With a focus on practical application, this course can help Software Engineers develop a solid understanding of design patterns and how to implement them in their own code. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Software Engineers can improve the quality, maintainability, and extensibility of their code.
Software Architect
For Software Architects, the Design Patterns in Go course can provide a valuable foundation in design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Software Architects can make informed decisions about the design and architecture of their software systems, ensuring that they are well-structured, maintainable, and scalable.
Technical Lead
Technical Leads can benefit from the Design Patterns in Go course by gaining a comprehensive understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Technical Leads can effectively guide their teams in developing high-quality software systems that are well-structured, maintainable, and scalable.
Senior Software Engineer
Senior Software Engineers with experience in Go can benefit from the Design Patterns in Go course, which provides a comprehensive overview of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Senior Software Engineers can enhance their ability to design and develop complex software systems, improving their code quality, maintainability, and extensibility.
Principal Software Engineer
Principal Software Engineers can benefit from the Design Patterns in Go course by gaining a comprehensive understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Principal Software Engineers can excel in their roles as technical leaders and mentors, providing guidance to their teams and ensuring the development of high-quality, maintainable, and scalable software systems.
Software Development Manager
Software Development Managers may find the Design Patterns in Go course useful for gaining a deeper understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Software Development Managers can effectively lead their teams in developing high-quality software systems, ensuring that they are well-structured, maintainable, and scalable.
CTO
For CTOs, the Design Patterns in Go course can provide a valuable foundation in design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, CTOs can make informed decisions about the design and architecture of their software systems, ensuring that they are well-structured, maintainable, and scalable.
VP of Engineering
VPs of Engineering may find the Design Patterns in Go course useful for gaining a deeper understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, VPs of Engineering can effectively lead their teams in developing high-quality software systems, ensuring that they are well-structured, maintainable, and scalable.
Software Consultant
Software Consultants can benefit from the Design Patterns in Go course by gaining a comprehensive understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Software Consultants can provide valuable advice to their clients, helping them develop high-quality, maintainable, and scalable software systems.
Freelance Software Developer
Freelance Software Developers can benefit from the Design Patterns in Go course by gaining a comprehensive understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Freelance Software Developers can enhance their ability to design and develop complex software systems, improving their code quality, maintainability, and extensibility.
Data Scientist
For Data Scientists, the Design Patterns in Go course provides a useful foundation in design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns. By gaining a deep understanding of these patterns, Data Scientists can effectively design and develop data processing and analysis pipelines, ensuring that their code is well-structured, maintainable, and scalable.
Web Developer
Web Developers may find the Design Patterns in Go course useful for gaining a deeper understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Web Developers can effectively design and develop complex web applications, ensuring that they are well-structured, maintainable, and scalable.
Mobile Developer
Mobile Developers may find the Design Patterns in Go course useful for gaining a deeper understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Mobile Developers can effectively design and develop complex mobile applications, ensuring that they are well-structured, maintainable, and scalable.
Game Developer
Game Developers may find the Design Patterns in Go course particularly helpful for gaining a deeper understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, Game Developers can effectively design and develop complex game systems, ensuring that their code is well-structured, maintainable, and scalable.
DevOps Engineer
DevOps Engineers may find the Design Patterns in Go course useful for gaining a deeper understanding of design principles and best practices. The course covers a wide range of topics, including the SOLID design principles, creational, structural, and behavioral design patterns, as well as modern variations and adjustments. By gaining a deep understanding of these patterns and their applications, DevOps Engineers can effectively design and implement automated software deployment and management pipelines, ensuring that they are well-structured, maintainable, and scalable.

Reading list

We've selected 11 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Design Patterns in Go.
Is the seminal work on design patterns and is essential reading for anyone who wants to learn about them. It provides a comprehensive overview of all the GoF design patterns, as well as modern-day variations and adjustments.
More accessible introduction to design patterns than the GoF book. It uses a light-hearted and humorous approach to teach the subject, and it includes many helpful diagrams and illustrations.
Comprehensive guide to design patterns in Java. It covers all the GoF design patterns, as well as modern Java-specific patterns. It valuable resource for anyone who wants to learn how to use design patterns in Java.
Classic guide to writing effective Java code. It covers a wide range of topics, including design patterns, concurrency, and performance. It valuable resource for any Java developer.
Practical guide to writing clean and maintainable code. It covers a wide range of topics, including design patterns, refactoring, and unit testing. It valuable resource for any software developer.
Classic guide to domain-driven design. It provides a practical approach to building software that is aligned with the business domain. It valuable resource for any software developer who wants to learn how to build better software.
Comprehensive guide to software architecture. It covers a wide range of topics, including design patterns, microservices, and cloud computing. It valuable resource for any software architect.
Practical guide to building microservices. It covers a wide range of topics, including design patterns, testing, and deployment. It valuable resource for any software developer who wants to learn how to build microservices.
Practical guide to reactive programming with RxJava. It covers a wide range of topics, including design patterns, testing, and deployment. It valuable resource for any software developer who wants to learn how to build reactive applications.
Practical guide to functional programming in Java. It covers a wide range of topics, including design patterns, testing, and deployment. It valuable resource for any software developer who wants to learn how to build functional applications.

Share

Help others find this course page by sharing it with your friends and followers:
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser