In episode 6, Miki built a logger package with the aim of making it as versatile as possible. To achieve this, he constructed his logger object with a function that would: accept the io.Writer interface as a parameter and perform type assertions to retrieve other interface types as needed. By building this, Miki demonstrated how polymorphism is achieved with Go by changing the type of a variable with type assertions.
In this video, Miki will shift his attention towards the theory side of programming and give a lecture on interface design. The first idea he’ll introduce is that interfaces state what need, not what we provide. To build on this idea, Miki will give a detailed overview of Go’s io.Copy function, its intended use and how the function states that it needs to have a variable to read from and another to write to. The next idea he’ll propose is if an interface has more than five functions, something may be wrong, which can be strongly correlated to the Go proverb the bigger the interface, the weaker the abstraction. Watch and learn more about Go interfaces and the design considerations to keep in mind when writing one.
Things you will learn in this video
From the Ardan Community
Get your team up to date with best practices & customized curriculum.
We help you evaluate your architecture, design, structure, tech-debt and human capital.
Learn at your own pace!
Special offers on upcoming training events & our latest blog posts.
Valid email required.
Submit failed. Try again or message us directly at firstname.lastname@example.org.
Check your email for confirmation.
We've built our reputation as educators and bring that mentality to every project. When you partner with us, your team will learn best practices and grow along the way.
Years in Business
Please fill out the form below, and we'll get back to you soon.
Check your email for confirmation of your sent message. We'll get back to you shortly.
Ardan Labs Copyrights © 2023