Go Design Patterns - Generator Pattern and Observer Pattern - Part Two

preview_player
Показать описание
#tensorprogramming #golang #designpatterns

In this tutorial, we take a look at the Generator pattern and the Observer pattern. We create a Generator function and then use the observe pattern to create a means to listen to it as a subject with multiple observers.

Support the Channel and Join Patreon:

Dontate:
ETH: 0x03247265dd5242605bD2FA3c40fb3b70d9e3D685
Cardano: addr1q9auccwrr9ws8qdyv45f4qwsx76pfmld4zapks89sakq94ay0xmle73y0r8ruwd0zslls4eglf98lghru7ywv56cedysk7ftjt

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

Very informative video! :')
Btw, you meant type assertion and not casting(type conversion) which is used for such situations where you had to wrap your concrete type into an interface and want your concrete type back. (This info might help others so putting it here.)

taufiqrahman
Автор

We are waiting for new videos on the patterns.
Tensor, you're cool.

ukraineSpaceman
Автор

Using two communicating threads inside a thight loop seems like an anti pattern to me. A better approach to generators in Go is a function that returns a function that captures state of the returning function. That way you can call the returned function without parameters multiple times and it will still yield different values.

larsheyden
Автор

@tensorprogramming what VSCode extension do you use to show the type under the cursor? Sorry if this already got explained.

larsheyden
welcome to shbcf.ru