Java Design Patterns: Visitor Live Coding

Publié le: 08 novembre 2023
sur la chaîne: datmt
34
0

Java Design Patterns: Visitor Live Coding.

The Visitor pattern is a way to perform actions on a group of different types of objects
without changing the classes of those objects.
Imagine you have a tool belt with different tools, and you have a job to do on a set of machines.
Each tool is like a "visitor" that can perform a specific job on one or more types of machines.
Instead of carrying the machine to your tool, you bring your tool to each machine.

This is how the Visitor pattern works:

👉 Visitors (The Tools):
These are like different tools in your tool belt.
Each tool knows how to do a specific job on any machine it can work on.

👉 Elements (The Machines):
These are like the machines you need to work on.
Each machine knows how to accept a tool and let it do its job.

👉 Accepting a Visitor:
When a machine accepts a tool, it's basically saying, "Okay, do your thing to me."
The machine allows the tool to work on it.

👉 Performing the Visit:
This is when the tool actually does its job on the machine.
Each type of tool knows exactly what to do with each type of machine.


Subscribe to get more tips on Software developments


Sur cette page du site, vous pouvez voir la vidéo en ligne Java Design Patterns: Visitor Live Coding durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur datmt 08 novembre 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 34 fois et il a aimé 0 téléspectateurs. Bon visionnage!