Learning Golang: Interface Types - Part 2 (empty interface, type assertion and type switches)

preview_player
Показать описание
Welcome! Let's learn about Go Types, specifically Interface Types, a little bit of Functions and Methods; and why all of those types are somehow interconnected.

* What is an Interface in Go?

An interface type is defined as a set of method signatures, a value of interface type can hold any value that implements those methods.

* How to implement Interfaces in Go?

Compared to other programming languages, a type implements an interface IMPLICITLY by implementing the methods; there's no need to refer to the original interface, there's no concept of "extends" or "implements". This means the actual concrete implementation of a type could appear in any other package without prearrangement.

In this episode I cover more about interfaces and types in Go like:

* Empty interface "interface{}",
* nil interfaces,
* Type assertions, and
* Type switches

---

RELEVANT LINKS

00:00 Intro
00:29 What is in an interface value in Golang?
04:27 Calling interface values with nil in Golang?
07:13 What is the empty interface{} in Golang?
08:35 Type Assertions and Type Switches in Golang
14:17 Conclusion - Interface Types in Golang

---

Who am I:

Hello👋🏼! I'm Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I've learned while working for small startups and large companies including the processes I've followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don't give up!

#golang #microservices #programming

--- Our affiliate links below

--- Our Vlog Channel

Рекомендации по теме
Комментарии
Автор

Could you provide a real-world example of the use of an interface, such as what might be used in an e-commerce application, or a dating website, or some relatable concept? I'm still not clear on specific use-cases wherein an interface would be utilized. I find most videos on Youtube focus on intermediate to experienced programmers. Relatable analogies usually work best for beginners & new learners to coding.

MrAverageViewer
Автор

Thanks for these videos, I know this stuff already but like to watch it how you explain it :)

TheDoppelganger
Автор

Sorry, but it looks like you got a talent of making things even more complicated than they are...

MaksymMinenko
Автор

these videos are really helpful thank you!!

garciajero
join shbcf.ru