FINALLY, the Visitor Design Pattern makes Sense

  Рет қаралды 9,101

Gui Ferreira

Gui Ferreira

Күн бұрын

Пікірлер: 28
@JohnOliverAtHome
@JohnOliverAtHome Жыл бұрын
Thanks Gui. Loved the (dynamic)this hint. It makes perfect sense and is so simple (now that I've seen it)
@gui.ferreira
@gui.ferreira Жыл бұрын
Great to hear, John! Thanks for taking the time to leave a comment.
@AndersBaumann
@AndersBaumann 11 ай бұрын
The visitor is an attempt to implement a functional pattern in an OO language. But C# is getting more functional so now the visitor pattern can elegantly be replaced by pattern-matching expressions.
@stevancosovic4706
@stevancosovic4706 Жыл бұрын
Very good explanation, thanks!
@gui.ferreira
@gui.ferreira Жыл бұрын
Glad you enjoyed it!
@tristanstricker967
@tristanstricker967 Жыл бұрын
Great video. I think the strategy pattern may be a better fit for this example but visitor is still great. You are making great c# content. Keep up the good work
@gui.ferreira
@gui.ferreira Жыл бұрын
Thanks! I think the Strategy Pattern can solve the same problem but doesn't give you the same benefits as the Visitor when you have a Composite. Thanks for the kind words, Tristan!
@marcotroster8247
@marcotroster8247 Ай бұрын
The visitor pattern works great for serializing / deserializing syntax trees. That's the typical case I know.
@gui.ferreira
@gui.ferreira 20 күн бұрын
True! In some languages, it is the most efficient way to do it.
@FreeMindInMotion
@FreeMindInMotion Жыл бұрын
Nice video. I have never used the pattern, but I will keep my eyes open. I like the dynamic type hint for the base class
@gui.ferreira
@gui.ferreira Жыл бұрын
Glad you liked it 🙏 In fact, it's rarely used but it's good to know how it works.
@vijaybhargavg8638
@vijaybhargavg8638 Жыл бұрын
This was brilliant.
@gui.ferreira
@gui.ferreira Жыл бұрын
Thank you 🙏
@MizenDaCat
@MizenDaCat Жыл бұрын
Hi Gui, do you have a video going through your IDE setup (themes, fonts, extensions)? If not, I think you should make one. What font are you using in this video?
@gui.ferreira
@gui.ferreira Жыл бұрын
Hi! Thanks for the suggestion. I'm not sure if I want to do a video on this channel about it, but I will try to find a way to have that information out there. Regarding the Font, on the video, I'm using JetBrains Mono.
@ilovepandaypoe6056
@ilovepandaypoe6056 Жыл бұрын
real world scenario, all those permutations will be stored in the database? so need really to create many classes?
@gui.ferreira
@gui.ferreira Жыл бұрын
You don't need to apply the visitor design pattern to domain or DB objects. It's a useful pattern for things like parsing or formatting
@franciscoamaral9834
@franciscoamaral9834 Жыл бұрын
Hi Gui, can you tell me what IDE are you using?
@gui.ferreira
@gui.ferreira Жыл бұрын
Hey Francisco! JetBrains Rider.
@vitek0585
@vitek0585 Жыл бұрын
As option the extension methods for the particular type can replace this pattern
@gui.ferreira
@gui.ferreira Жыл бұрын
Not that you can't do it in other ways in C#, but even then, it's not an "apples to apples" comparison.
@HizusHiz
@HizusHiz Жыл бұрын
Still doesn't make sense for c# because you can use pattern matching which will be faster.
@jeffg4686
@jeffg4686 8 ай бұрын
The problem with the visitor pattern is fundamental. It breaks readability. It lacks domain understanding. To "Visit" isn't a verb with meaning.
@ppg68
@ppg68 5 ай бұрын
While I agree, I find the idea of isolating the Methods into Objects quite useful, you only have to modify the code in one class without breaking anything else
@jeffg4686
@jeffg4686 5 ай бұрын
@@ppg68 - I'm needs based. I never really found a need for this pattern. And when I see it used, it's never relevant, reads horrible, and fails to convince me that I need it. Just like the bridge pattern. Things start getting too pattern happy after a while...
@Autumn4_love_your_
@Autumn4_love_your_ Жыл бұрын
Its a replacement for a type switch case
@asusvenus
@asusvenus Жыл бұрын
Great content. Although, I think its way too zoomed in
@gui.ferreira
@gui.ferreira Жыл бұрын
That's great feedback! Thanks! I've been using Presentation mode lately. I will revisit it 😉
The Design Pattern Everyone MUST Know!
7:13
Gui Ferreira
Рет қаралды 3,9 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
ASRock Steel Legend Intel Arc B580: A Legendary Value!
7:46
Level1Techs
Рет қаралды 44 М.
Your code Knows too much!
5:12
Gui Ferreira
Рет қаралды 4,7 М.
THIS stops 90% of C# Developers Learning TDD
19:40
Gui Ferreira
Рет қаралды 15 М.
Visitor Pattern in Java and Python
22:02
Do Some Dev
Рет қаралды 365
Refactoring C# with Chain of Responsibility
6:43
Gui Ferreira
Рет қаралды 8 М.
Vertical Slice Architecture, not Layers!
46:24
CodeOpinion
Рет қаралды 126 М.
What’s the Result Type Everyone Is Using in .NET?
14:47
Nick Chapsas
Рет қаралды 114 М.
Start Your TDD Journey with C# in 15 MINUTES
14:55
Gui Ferreira
Рет қаралды 23 М.