[Golang] Builder

  Рет қаралды 6,410

Panpito

Panpito

2 жыл бұрын

Today, the builder pattern!
Twitter: / panpit0
• 🧠 DESIGN PATTERNS 🧠
• 🎥 GO FOR IT! 🎥
• 📚 PUBLISHING YOUR LIBR...
• 💥 ALL ABOUT GO 💥
---
Golang version: 1.16
IDE: Goland
OS: Windows
Accent: French

Пікірлер: 13
@rolandwarburton387
@rolandwarburton387 Жыл бұрын
Great beginner level intro, was easy to follow
@nicknick65
@nicknick65 2 жыл бұрын
perfect, nicely explained
@pronoe
@pronoe 2 жыл бұрын
"So `me`, I'm a `Human`"... Nice try reptilian lol. Nice video, I like the way you explain and show the code. A video about pointers (*, &, ...) would be really cool. I'm coming from python and I just let my IDE handle those things for me without really understanding what's going on.
@panteliskaramolegkos2693
@panteliskaramolegkos2693 2 жыл бұрын
Nice video! I see you are using value receivers. Would it make any practical difference had you used pointer receivers e.g. *human? Is there a convention / better way to go about it when using the Builder pattern?
@--husky_codes2099
@--husky_codes2099 Жыл бұрын
Pointer receivers and Value receivers are very similar almost the same, the only difference would be if you want to have an original copy of the human struct you shall use value receiver but if you want to modify the original human struct you may use *receiver.
@midewestmond9442
@midewestmond9442 11 ай бұрын
You modifying then you should be using pointer I think
@abiodun6897
@abiodun6897 2 жыл бұрын
where can i learn about this pattern extensively
@sidikridwan
@sidikridwan Жыл бұрын
nice tutorial, im new in best practices of golang i read some articles that say no need to create builder pattern in golang since you can directly assign the value and if there is no logic inside the builder function, so my question when we use or not use the builder pattern and what is the best practice for assigning value to struct?
@panpit0
@panpit0 Жыл бұрын
this is my opinion: - use it if you have a lot of fields to build - it's fine if it's just assigning the value, but you might have some tricky cases where a builder pattern is invoking another builder pattern for complex construction - "best practice for assigning value to struct" > as long as you in control of your data structure lifecycle, it's okay to use raw instantiation, simple constructor or a builder pattern. I usually tend to have a functional programming style and avoid to mutate fields and getting out of control
@necroowl3953
@necroowl3953 2 жыл бұрын
This is missing a lot of points like having a separate HumanBuilder struct which is the one with all the methods (idiomatically named Age() and EyeColor(), not using the "with" prefix), and the Build() method that returns a Human and an error (you're not evaluating user input here. I have to say that if you are a senior dev in your company, then I should be a CEO lol
@panpit0
@panpit0 2 жыл бұрын
lol thanks for your kind words, I'm sure you're an excellent software engineer and an amazing team player! Kind regards
@rolandwarburton387
@rolandwarburton387 Жыл бұрын
where can i learn more about these more advanced builder pattern topics?
@abiodun6897
@abiodun6897 2 жыл бұрын
where can i learn about this pattern extensively
[Golang] Singleton
16:43
Panpito
Рет қаралды 2 М.
[Golang] Dependency injection with Fx
33:10
Panpito
Рет қаралды 7 М.
Can You Draw A PERFECTLY Dotted Line?
00:55
Stokes Twins
Рет қаралды 114 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,8 МЛН
[Golang] Memento
32:02
Panpito
Рет қаралды 764
Rust Programming: TypeState Builder Pattern Explained
14:30
Jeremy Chone
Рет қаралды 29 М.
Builder Pattern - Design Patterns
10:49
Web Dev Simplified
Рет қаралды 135 М.
[Golang] Factory method
7:02
Panpito
Рет қаралды 6 М.
[Golang] Adapter
18:25
Panpito
Рет қаралды 2,1 М.
Fluent Builder in Python: Building Objects with Elegance
20:54
campbelltech
Рет қаралды 1,4 М.
Go Design Patterns - Factory and Abstract Factory Pattern - Part Three
16:23
[Golang] Interfaces and dependency injection
8:27
Panpito
Рет қаралды 21 М.
[Golang] Facade
26:02
Panpito
Рет қаралды 449