The Visitor Pattern Explained and Implemented in Java | Behavioral Design Patterns | Geekific

preview_player
Показать описание

I've received over the years a lot of feedback stating that the Visitor pattern is one of the hardest to grasp. In this video, we detail and explain the Visitor Design Pattern and hope that it'll clear things up!

Timestamps:
00:00 Introduction
00:07 What is the Visitor Pattern?
02:11 Visitor Pattern Implementation
03:38 The Visitor Pattern Class Diagram
05:02 Recap
05:36 Thanks for Watching!

If you found this video helpful, check other Geekific uploads:

#Geekific #DesignPatterns #VisitorPattern #BehavioralPatterns
Рекомендации по теме
Комментарии
Автор

by choosing good example pattern suddenly becomes very clear, thank you

duganets
Автор

You have no idea how helpful these videos are! ❤❤

Jeff_Leon
Автор

hi, I am been programming for about 300 years,
no just kidding 😁, for 30 years.
I must say "well done sir"
my question for you: where did you get your knowledge please? which books, or through experience and coworking with others?
thank you for your accurate and professional videos.

truth-
Автор

This explanation is very clear! Now I can finally understand this Visitor pattern thank to this video. Thank you!

jordiyaputra
Автор

at 3:19, from the Bank class you are calling visitor.visitBank(this),
but there is no such function,
the declared function was visit(Bank bank)

DeepakKumar-ylok
Автор

very good explanation. Thank you for your effort.

abdurrahmanpektas
Автор

Quick to the point and easy to understand. Kudo

varshard
Автор

Wow thank you sir for great explanation... This pattern always confused me but your video makes it

kennethcarvalho
Автор

Hi, thanks for great explanation.
just wondering at 2:59 your Visitor Interface consists of methods with name void visit(Bank bank), void visit(Company company) ... etc

but jump in to your example at 3:25, the method in Client concrete class(Bank, Restaurant, Resident) inside their method void accept(Visitor visitor) it become visitor.visitBank, visitor.visitRestaurant ... etc instead of just visit as previous Interface. could you explain why these two are different ?

indranurzaman
Автор

Great video. Thanks for the clear explanation!

onomatopeia
Автор

Thanks for the video, it's really helped 👍 It's interesting that for each concrete element you might need an individual method in the Visitor interface. I guess this would only be suitable if you don't expect too many concrete elements or they could largely be operated on the same?

danielchandler
Автор

great video
In the diagram at 3:55, the visitor interface should not have the functions visitA(ElementA), visitB(ElementB),
rather it should have visit(ElementA) and visit(ElementB) 🤔,
similiarly for the concreteVisitor

I think both are okay
@geekific can you please suggest which pattern to follow
or what is the industry standard? (visit or visitA)

DeepakKumar-ylok
Автор

Thank you so much for this very helpful tutorial ! 🙏🙏🙏

rayunn
Автор

I'm a bit confused by the open-closed principle. Here, we can modify the class ConcreteVisitor and the interface Visitor if we need to add new specific methods for the clients. But wouldn't we be breaking this principle? From my understanding of previous patterns, we added classes, so we didn't need to modify existing ones...

CanalRD
Автор

very very good explanation. Thanks so much

javiercozar
Автор

This seems like it just moves the problem around. Isn't the Visitor interface now open for modification? Every time you want to add a new type of element, it needs to be changed, and so all concrete implementations need to be changed as well.

atrus
Автор

amazing explanation the only thing i would do is to separate the accept method from client interfae for interface segregation principle and single responsabilty apart all was amazing

josetorrealba
Автор

Could you elaborate more on how not using the visitor pattern was breaking the open/closed principle? I still think that this wasn't the case since classes were already extendable without modifying them, which is the only concern of the open/closed principle.

alyabouzaid
Автор

this pattern is similar to sharing food with younger siblings. they always say I got less portion.
you give food to them and ask them to choose your portion and give it to me.

shaikchandbasha
Автор

Is there an example of where accept would be implemented differently for each Element?

sidekickrida