36. Visitor Design Pattern | Double Dispatch | Low Level Design

Поділитися
Вставка
  • Опубліковано 22 тра 2024
  • ➡️ Notes link:
    Shared in the Member Community Post (If you are Member of this channel, then pls check the Member community post, i have shared the Notes link there)
    ➡️ Join this channel to get access to member only perks:
    / @conceptandcoding
    Chapter:
    00:00 - Problem it try to solve
    02:18 - Definition of Visitor Pattern
    04:31 - UML and Example
    21:04 - Single and Double Dispatch
    29:40 - Visitor Vs Strategy Design Pattern
    #lld #systemdesign #designpatterns

КОМЕНТАРІ • 35

  • @shankar7435
    @shankar7435 Місяць тому +3

    The best video on visitor pattern. Especially showing code snippets in the same structure that mimic its uml diagrams made this pattern understandable. Great technique. It worked wonders for this video.

  • @khalidhashimeh
    @khalidhashimeh Місяць тому +1

    You are a talented teacher..

  • @yogeshchanekar6263
    @yogeshchanekar6263 Місяць тому +1

    Best video I seen today which clear my doubt , Thank you buddy

  • @NishantTaletiya
    @NishantTaletiya 6 місяців тому +3

    wow kya samjate ho aap itna complex subject design pattern me samaj nahi pa raha tha ki exam me kya likhu kese karunga lekin aapke video dekhne ke baad sab aasan lag raha hai. me jab search karta kuch to likhta hu "this design pattern by concept and coding". Thank you so much.

  • @prashanthmeka354
    @prashanthmeka354 6 місяців тому +2

    Explained with good example. Additional info about strategy pattern comparison gives even more context to the explanation. Appreciated 👍

  • @liquidmetal718
    @liquidmetal718 4 місяці тому

    I think you missed about the advantage of visitor pattern - the visitor would not be aware of structure of hosting classes. The host class would unravel it's children , let visitor traverse through it and collect information. I think that's part where algorithm is separated from operations / actions possible on it.

  • @baburaomulaparthi4531
    @baburaomulaparthi4531 Місяць тому

    Nice vedio. graet explanantion.
    can we declare Roomvisitor as below.
    interface RoomVisitor{
    void visit(RoomElement element);
    }
    if new roomtype added in future.

  • @adityask22
    @adityask22 6 місяців тому

    Hi,
    Great videos. Ive read multiple resources. However, your explanation on all patterns is very clear.
    On the next videos: Can we take some code from some repo and think of where all there is scope for improvement and which Design Pattern can help us solving it. This helps in identifying the actual design pattern needed and very much needed in our real world.

    • @ConceptandCoding
      @ConceptandCoding  6 місяців тому

      Awesome input, thanks, will add it to my bucket list

  • @charutandon5317
    @charutandon5317 24 дні тому

    Hi, what do you use to create these UML diagrams? @ConceptandCoding ?

  • @sameer9368
    @sameer9368 5 місяців тому +1

    Great tutorial so far I have gone through

  • @crazeeealgorithms3236
    @crazeeealgorithms3236 3 місяці тому

    Lets say that in the future a new room type is added, then we need to add its corresponding visit() function in all the visitors so here we are again modifying the existing code to accommodate the new room, will this not violate open/closed principle?

    • @yogeshchanekar6263
      @yogeshchanekar6263 Місяць тому

      When using the Visitor pattern, you define a separate visitor interface and implement different visitor classes to perform operations on elements of an object structure. In Java, this typically involves implementing the accept method in each element class, which takes a visitor as an argument.
      A violation of LSP could occur if adding new element subclasses requires modifying the visitor interface or any of its implementing classes. If this modification causes unexpected behavior or forces changes in existing visitor implementations, it could potentially break the principle.

  • @LegitGamer2345
    @LegitGamer2345 6 місяців тому +2

    Lets say that in the future a new room type is added, then we need to add its corresponding visit() function in all the already tested implementing visitor classes, is there a way to handle this without touching the tested classes ?

    • @ConceptandCoding
      @ConceptandCoding  6 місяців тому +1

      Actually this is one of the disadvantage of Visitor pattern.

    • @ajayjangid1164
      @ajayjangid1164 2 місяці тому

      Yes, as compare to “count-of-adding-new-room-type” with “count-of-adding-new-functions” is can be huge. so we can say that visitor pattern don’t completely removes re-testing and vertical growth of classes instead we can say it “minimizes” them.

  • @yuvhrajverma6158
    @yuvhrajverma6158 6 місяців тому

    sir in command pattern whats the role of invoker apart from applying undo feature like if we don't want undo feature then client already has reference to command and the receiver so client can directly call commands execute method and still there is no tight coupling between client and receiver and in uml why client doesn't have a HAS-A relation with invoker , plz reply sir

    • @ConceptandCoding
      @ConceptandCoding  6 місяців тому

      ack of the question

    • @LegitGamer2345
      @LegitGamer2345 6 місяців тому

      think about it like this: u can perform operations on a TV with a remote, but u can also do things like changing the channel and increasing/decreasing the volume directly by interacting with the TV also, then what is the use of remote ?

  • @WasteMaterial-vr3qe
    @WasteMaterial-vr3qe Місяць тому

    When you approach a problem in interview or in your work. How do you think like this design pattern can work?
    I know in every pattern video you have told when it can be used but still it's not a piece of cake to figure out the design pattern
    Eg: In Apply Coupon Video of yours, I implemented without Decorator but you used Decorator. How come you or anyone think in that direction? If you can share insights, it might help others as well.

    • @shankar7435
      @shankar7435 Місяць тому

      That's the game of problem solving ability companies look for. It comes with practice and many refer it as experience.😊😊😊

  • @NamanJain-dj7te
    @NamanJain-dj7te Місяць тому

    can you share its pdf?

  • @shubhamaptekar7748
    @shubhamaptekar7748 Місяць тому

    I am confuse that stratergy and bridge look similar because both focus on seprating a feature . Please help

    • @ConceptandCoding
      @ConceptandCoding  Місяць тому +1

      Shubham, you will find many patterns similar and doing same thing,
      only thing differs is intention.
      Strategy is Behavioral patterns which more focus on how to divide the responsibilities between objects (or in simple term how different objects should communicate whith each other)
      while bridge patterns is a structural pattern, which focus on how to organise objects to form a large structure.
      Ultimately both solution looks same but they tried to solve diff things, and same thing you find with many other patterns which look similar

    • @shubhamaptekar7748
      @shubhamaptekar7748 Місяць тому

      @@ConceptandCoding thank you for taking time and replying sir

  • @sargamgoyal4161
    @sargamgoyal4161 6 місяців тому

    Hi @ConceptandCoding ,, Thank you so much for such great content. Can you please make LLD videos on Swiggy / Zomato && Make my Trip, if possible. It will be very helpful.

  • @anketpatel2312
    @anketpatel2312 6 місяців тому +1

    I can understand the things but sometimes I feel like better to do simple code without this kind of design pattern.
    Simple code is always easy to understand and update.

    • @ConceptandCoding
      @ConceptandCoding  6 місяців тому

      Definitely they are, but if you see, Java lib which we are using are full of usage of design patterns.
      So these principles and pattern do have an impact on scalability.

    • @rabindradocument8934
      @rabindradocument8934 6 місяців тому +1

      ​@ConceptandCoding can you please show where this design pattern used in java lib

  • @AnkitSharma-bp5rc
    @AnkitSharma-bp5rc 6 місяців тому

    Great Video, but why did you change your language from Hindi to English. Your videos in Hindi were much more involving. It's very easy to understand stuff in our mother tongue.