Write Better GO Code: Composition

preview_player
Показать описание
In Golang what is composition and how to use it to write better code?
Рекомендации по теме
Комментарии
Автор

This is so elegant. Can’t wait to see more go content in this channel

sidreddy
Автор

Good work Mux. Which Vs code theme is close to what you're using

katungiyassin
Автор

Thank you so much for the content! What app do you use for code animations?

norayrsargsyan
Автор

Nice video. I have a one nit here though to raise
in 100 go mistakes there is a section about embedding saying the following:

> What can we say about type embedding? First, let’s note that it’s rarely a necessity,
> and it means that whatever the use case, we can probably solve it as well without type embedding.
> Type embedding is mainly used for convenience: in most cases, to promote behaviors.

and then it also says

> Using type embedding consciously by keeping these constraints in mind can help avoid
> boilerplate code with additional forwarding methods. However, let’s make sure we don’t do it
> solely for cosmetics and not promote elements that should remain hidden

given the above, what would you do differently? (I still haven't decided which is better yet tbh)

Another question I have is I see you using `database.GetGuestFeatures()` which makes me believe you have a function `GetGuestFeatures()` under a `database` package. My question is how would you unit test HasFeature function here?

ahmethatipoglu
Автор

Can you share the github code for this ?

nabinsaud