Deep Dive Into Go Lang Interfaces
55mAdvanced2024-05-13
Authors

Miki Tebeka
CEO at 353Solutions
Course details
Go has a unique approach to some of the methods used in object-oriented programming–particularly with interfaces. In this course, learn how to design and use interfaces in Go. Instructor Miki Tebeka takes a look at various important interfaces in the standard library and examines how interfaces are implemented and the cost of using them. Learn about design decisions behind interfaces and how you can design your own interfaces to be smaller and more performant. And finally, get a look at empty interfaces—including why they’re needed and how you can work with them.
Skills covered
Programming LanguagesSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Go interfaces
- 02 - What you should know
- 03 - Getting started with Codespaces
1. Interfaces in Go
- 04 - When should you use interfaces
- 05 - How interfaces are implemented
- 06 - The cost of using interfaces
2. Interface Design
- 07 - Say what you need, not what you provide
- 08 - Case study - Analyzing sort.Interface
- 09 - Embedding interfaces
- 10 - Using type assertion to keep the interface small
- 11 - Design for performance
- 12 - Challenge - Interface design
- 13 - Solution - Interface design
3. I O-Related Interfaces
- 14 - The io.Reader and io.Writer interfaces
- 15 - Composing readers and writers
- 16 - In-memory readers and writers
- 17 - Implementing io.Reader and io.Writer
- 18 - Challenge - Counting lines in a compressed file
- 19 - Solution - Counting lines in a compressed file
4. Interfaces That Change Behavior
- 20 - String representation with fmt.Stringer
- 21 - Using fmt.Formatter to support print flags
- 22 - Custom JSON serialization with json.Marshaler and json.Unmarshaler
- 23 - Challenge - Custom error
- 24 - Solution - Custom error
5. The Empty Interface
- 25 - What is the empty interface
- 26 - Using reflection with the empty interface
- 27 - Using generics to avoid the empty interface
- 28 - Challenge - Wrapping sync.Pool
- 29 - Solution - Wrapping sync.Pool
Conclusion
- 30 - Next steps
Related courses
- Additive Manufacturing: Materials for 3D Printing
- Oracle Cloud Infrastructure Architect Associate (2022)
- Create a Go-to-Market Plan
- Spring Boot Observability: Deep Dive into Logging, Metrics, and Tracing
- Corporate Financial Statement Analysis (2019)
- Building Production-Ready React Apps: Setup to Deployment with Firebase
- ISO 27001:2022-Compliant Cybersecurity: Getting Started
- Lightroom: Creating Effects
Related learn paths
- Develop Your NoSQL Skills
- Become a Corporate Financial Planning Analyst
- Design User Experiences with Figma
- Introduction to Fundamental Skills for Data Work: Data Visualization
- Advance Your Skills as a User Experience Researcher
- Advance Your Spring Development Skills
- Manage Your LLMs with LLMOps
- AI Regulations for Tech Leaders: The EU AI Act and More