Visitor Design Pattern Tutorial with Java Coding Example for Beginners | Visitor Pattern Explained смотреть онлайн
Visitor design pattern is a behavioral design pattern. Visitor design pattern lets you separate algorithms from the objects on which they operate. With the help of visitor pattern, we can move the operational logic from the objects to another class. As per the pattern, element object has to accept the visitor object so that visitor object handles the operation on the element object.
We use a visitor class which changes the executing algorithm of an element class and execution algorithm of element can vary as and when visitor varies. It is a way of separating the algorithm (logic) from the current data structure.
The Visitor pattern suggests that you place the new behaviour into a separate class called visitor, instead of trying to integrate it into existing classes. The original object that had to perform the behavior is now passed to one of the visitor’s methods as an argument, providing the method access to all necessary data contained within the object.
** Problem and Solution **
The most common example of visitor pattern is shopping in the supermarket. In the supermarket, we pick the goods and add them to our cart. When we collect all the necessary goods to the cart, we go to the bill desk for billing. The cashier checks all the goods picked by us and tells us the total amount; we have to pay. Here, the cashier acts as a visitor on our cart to calculate the total cost. Helper in stores could be another example of visitor for our cart who helps dragging the shopping cart from store to my car.
** Where to use Visitor Design Pattern **
1. Use visitor design pattern whenever we have to perform an operation on a group of similar kind of Objects.
2. Use visitor design pattern whenever you need to perform an operation on all elements of a complex object structure (for example, an object tree).
3. Use visitor design pattern whenever you want to clean up the business logic of auxiliary behaviors.
4. Use visitor design pattern whenever a behavior makes sense only in some classes of a class hierarchy, but not in others.
** Advantages of Visitor Design Pattern **
1. Supports Open/Closed Principle. You can introduce a new behavior that can work with objects of different classes without changing these classes.
2. Supports Single Responsibility Principle. You can move multiple versions of the same behavior into the same class.
3. A visitor object can accumulate some useful information while working with various objects. This might be handy when you want to traverse some complex object structure, such as an object tree, and apply the visitor to each object of this structure.
4. If the logic of operation changes, then we need to make changes only in the visitor implementation.
** Chapter Timestamps **
0:00 Welcome to Visitor Design Pattern
0:23 Recap of Template Method Design Pattern
1:29 Introduction to Visitor Design Pattern
2:28 Real world example of Visitor Design Pattern
3:28 Java coding example of Visitor Design Pattern
8:57 Usage of Visitor Design Pattern
9:32 Advantages of Visitor Design Pattern
10:18 Summary of Visitor Design Pattern
#visitorpattern #visitordesignpattern #javadesignpatterns
** Previous Video Links **
Template Method Design Pattern https://youtu.be/7kQ2-7qy5hY
** GITHUB Project **
https://github.com/codeonedigest/javadesignpattern
** CHECK OUT OUR OTHER VIDEOS **
Spring boot project setup: https://youtu.be/bsgA20eJKxs
Spring Boot Microservice with postgres database Project: https://youtu.be/iw4wO9gEb50
Prepare Docker file, Container and Build Image: https://youtu.be/g_pdTzjnuso
Deploy Docker Image AWS Elastic Container Service: https://youtu.be/ZlR5onuwZzw
Run MongoDB in Docker Container: https://youtu.be/r4Yl4SO1BiA
** CHECK OUR PLAYLISTS **
Java Design Pattern Complete Tutorial https://youtube.com/playlist?list=PL2NZAYdLkYvglL0xl-4tgBAribrcjeuNH
Spring Boot Complete Tutorial https://youtube.com/playlist?list=PL2NZAYdLkYvg_VlNmszrb-Um0wRx5yGDF
Docker Containers Complete Tutorial
https://youtube.com/playlist?list=PL2NZAYdLkYvhZQo2VTVCSug_zVjekNodi
** ABOUT OUR CHANNEL **
CodeOneDigest is a youtube channel that produces videos on programming languages, cloud and container technologies, Software design principles, Java frameworks in English and Hindi languages.
Check out our channel here:
https://www.youtube.com/channel/UC9V0QYsWKz_OD2uooCtEtRg
Don’t forget to subscribe!
** OUR WEBSITE **
https://codeonedigest.wordpress.com/
** GET IN TOUCH **
Email us on [email protected]
FOLLOW US ON SOCIAL - LIKE, SHARE & SUBSCRIBE
Youtube: https://www.youtube.com/channel/UC9V0QYsWKz_OD2uooCtEtRg
Twitter: https://twitter.com/codeonedigest
Facebook: https://www.facebook.com/codeonedigest
Linkedin: https://www.linkedin.com/in/codeone-digest-10b418255/
Github: https://github.com/codeonedigest
Website: https://codeonedigest.wordpress.com/
Tumblr: https://www.tumblr.com/codeonedigest
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Visitor Design Pattern Tutorial with Java Coding Example for Beginners | Visitor Pattern Explained» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.