Interfaces in Go - Discovering Behavior

Ғылым және технология

Learn Go interfaces by refactoring code to discover interfaces based on the behavior of concrete types. Enjoy!
00:00 Introduction
00:27 Quotes for Interfaces
01:25 Notifying with a Discord Client
03:02 Adding an Email Client
05:02 Discovering the Notifier Interface
08:48 Extending the Notifier Interface
13:00 Accept Interfaces, Return Structs
15:17 Implementing a Mock Notifier for Testing
19:53 Recap of Interfaces
22:10 Final Thoughts
Find the code at github.com/sudomateo/sudomateo.
Personal Website: matthewsanabria.dev
GitHub: github.com/sudomateo
LinkedIn: / sudomateo
Twitter: / sudomateo
Mastodon: mastodon.online/@sudomateo
KZread: / @sudomateo

Пікірлер: 12

  • @sudomateo
    @sudomateoАй бұрын

    Please excuse the nasally voice. I recorded this just as I was getting sick so I was a bit stuffy.

  • @Cspartan_1291
    @Cspartan_1291Ай бұрын

    MOM! Wake up! Matthew uploaded a new video!

  • @sudomateo

    @sudomateo

    Ай бұрын

    This is the way!

  • @selvamp5775
    @selvamp5775Ай бұрын

    👏👏👏

  • @0lange
    @0langeАй бұрын

    Loving the go content, so clear and easy to grasp. I would pay for your courses 😆

  • @sudomateo

    @sudomateo

    Ай бұрын

    Thank you for the kind words! I'm not against creating course content, I would just need to dedicate time to creating the content and make sure it's financially accessible to everyone. I have some strong opinions on some of the course content out there that takes advantage of aspiring engineers.

  • @0lange

    @0lange

    Ай бұрын

    Fair enough :I) Also a future video suggestion: concurrency stuff (channel and mutex)

  • @sudomateo

    @sudomateo

    Ай бұрын

    @@0lange I got you! Concurrency stuff is next on the list. I ranked some suggestions based on frequency and concurrency was top 3. I'll be recording that when I'm back from GopherCon.

  • @indifferentghozt
    @indifferentghoztАй бұрын

    Don't forget to hit that bell!

  • @sudomateo

    @sudomateo

    Ай бұрын

    Like. Subscribe. Hit the bell. Grow the beard. All the good things!

  • @aniellosgambato
    @aniellosgambato28 күн бұрын

    I like this content. Just one thing I know this is a jus a simple example but you are not testing the SendNotification function at all here. I see that you want show how you can take benefit of interfaces to create mocks that can help during unit tests, but this is a little bit misleading on how write a good unit test. By the way I appreciate your efforts and I am waiting for other content related to Golang. B.R.

  • @sudomateo

    @sudomateo

    28 күн бұрын

    Thank you! More content will be coming soon. I wasn't going to include any testing in this video at first but the I was like ah heck why not? I really wanted to show how one can implement interfaces to be used in tests rather than writing a perfect unit test. I probably should have asserted on the message to test the behavior specific to SendNotification. In the current form it's really just testing that the notifier(s) get called.

Келесі