Design a Vending Machine | LLD Interview Question | State Design Patterns | OOPS | Java

Поделиться
HTML-код
  • Опубликовано: 23 июн 2022
  • 🔴 Check out Geeks for Geeks System Design Course : bit.ly/3tZ4wnm
    🔴 Connect with me on Instagram - / code.blooded.voyager and ask me doubts 1:1. Would try to reply to each one of you.
    🔴 Builder Design Pattern Explained : • Understanding Builder ...
    🔴 Decorator Design Pattern Explained : • Decorator Design Patte...
    🔴 Amazon SDE Revision Sheet : • Video
    🔴 Join My Telegram Channel for Placement Updates and attend my Free Live Classes on DS Algo - telegram.me/riddhi_dutta
    🔴 Connect with me on LinkedIn - / riddhi-dutta
    🔴 Graph Placement Series From Scratch - • Graphs - The Ultimate ...
    🔴 Link to my TopicWise SDE Sheets Playlist : • Trees SDE Coding Probl...
    Tags
    #designpatterns #builderpattern #lld #oops #java #lowleveldesign #lld #statepattern #vendingmachine

Комментарии • 70

  • @vatsalmaheshwari692
    @vatsalmaheshwari692 Год назад +8

    I believe that this does not fulfill Interface Segregation principle of SOLID principles. There is no need of insertCoin and presButton in some cases. We should make different interfaces if any state does not want to implement a function. Tell me if I am wrong. I would love to get corrected.

  • @aishwaryapani4662
    @aishwaryapani4662 2 года назад

    Very helpful video, at a time when there is a dearth of LLD resources. Thank you for making these ❣

  • @fares.abuali
    @fares.abuali 2 года назад +1

    Thank you so much, Mr. Riddhi.
    Consie & Informative

  • @rohitshaw6862
    @rohitshaw6862 2 года назад +1

    A much needed content. Very few people are there who create videos on this topic. Thank you for your initiative 😁.

  • @debmalyapan53
    @debmalyapan53 2 года назад +1

    this was highly required. thanks da.

  • @snehomoymaitra9317
    @snehomoymaitra9317 2 года назад

    Amazing content as many of the companies are asking LLD questions in their SDE-1 (e.g - freshers) interviews.

    • @rite2riddhi
      @rite2riddhi  2 года назад +1

      Thank you ❤️

    • @vinamrasangal8436
      @vinamrasangal8436 19 дней назад

      how can a person write such a big LLD code in just 1 hr ???

  • @rishav144
    @rishav144 2 года назад

    need more LLD videos like this ....please

  • @zahidkhan-ln3jv
    @zahidkhan-ln3jv Год назад

    Great explanation! Can we use the same design pattern to design a shopping cart?

  • @abhishekrai5212
    @abhishekrai5212 Год назад

    I really liked the design as well as the explanation. Please create more such LLD design content👍

  • @nikhilk4735
    @nikhilk4735 Год назад

    Great explanation. Can you please share link to this code repo

  • @namantyagi6294
    @namantyagi6294 2 года назад

    In an actual lld interview, do we need to write the whole methods and class or just a skeletal design with the classes and methods just declared and not completely implemented?

    • @rite2riddhi
      @rite2riddhi  2 года назад

      Depends. In an lld interview , important functions you have to write. For machine coding , you have to write everything.

  • @dopamine003
    @dopamine003 9 месяцев назад

    Great explanation

  • @email4pranav
    @email4pranav 2 года назад +2

    Hey could you upload this code to a GitHub repo?

  • @sarfrazz34
    @sarfrazz34 Год назад +4

    Riddhi, could you please share the git repo link for the same?

    • @chetanpareek4428
      @chetanpareek4428 Месяц назад

      @Riddhi could you please share the github link of this code ?

  • @chodingninjas7415
    @chodingninjas7415 Год назад

    Great stuff

  • @Maneeshce2007
    @Maneeshce2007 10 месяцев назад

    Where is the github url to find the code ??

  • @divyajyotibasu3001
    @divyajyotibasu3001 8 месяцев назад

    Hi, Thanks for the helpful tutorial. If possible kindly share the codebase in a repository. Regards!

  • @satyajeetkumarjha1482
    @satyajeetkumarjha1482 2 года назад

    Can you post the link to GitHub repo?

  • @JigyasaGupta-nx9pk
    @JigyasaGupta-nx9pk Год назад

    do u have a git hub link

  • @hell-o8470
    @hell-o8470 Год назад

    where can i get the code?

  • @obsessiveDreamer
    @obsessiveDreamer 2 года назад

    Are you passing the object of the vending machine into all three states' constructors as a reference or a copy of the object? I mean all three states is working on the same instance of vending machine?

  • @iamdips00356
    @iamdips00356 Год назад

    Amazing video

  • @sudipasarkar7981
    @sudipasarkar7981 2 года назад

    Amazingly explained much needed one😃😇

  • @tanveer.shaikh
    @tanveer.shaikh Год назад

    instead of throwing illegal state can we sent some warning and be on same state

  • @harshraj22_
    @harshraj22_ 2 года назад

    It's kind of strange that states need vending machine to initiate, and vending machine meeds states. Looks like a kind of circular dependency, and becomes more confusing when you think composition in terms of " class has a" property.
    Also, taking out inventory instance out of vending machine class, and performing operations on it doesn't sound quite good to me. Wouldn't it be more better if vending machine rather exposes some methods to operate on inventory, rather than giving off its internal objects to outsiders ?

    • @rite2riddhi
      @rite2riddhi  2 года назад

      For 2 , yes have added addProductToInventory() in the Vending Machine itself. User will only interact with VM. I focussed on the main problem , hence skipped few things.
      For 1 , it won't be a cyclic dependency. Again , as I said no design is perfect , and it is not possible to come up with a flawless design in a 1hr interview.

  • @pratosh
    @pratosh Год назад

    is there any github repo for this design?

  • @Kapil_Sharma_Engineer
    @Kapil_Sharma_Engineer 2 года назад +1

    Small doubt is do we really need a State interface on which Vending machine is dependent. I feels like we can have a enum of states or a current state variable based upon that we can give the functionality output

    • @rite2riddhi
      @rite2riddhi  2 года назад +1

      Won't that result in a lot of if else handling? How would you achieve runtime polymorphism?

    • @Kapil_Sharma_Engineer
      @Kapil_Sharma_Engineer 2 года назад

      @@rite2riddhi yes there will be more if-else handling. And regarding polymorphism maybe I will use a strategy pattern but one this is I will give try to use the Abstract class with default function definition so that we don't need to define a function with the same functionality in multiple classes

    • @rite2riddhi
      @rite2riddhi  2 года назад +1

      @@Kapil_Sharma_Engineer using multiple if else might not be good for code readability. But yes , again design is an open ended discussion. 😅

    • @Kapil_Sharma_Engineer
      @Kapil_Sharma_Engineer 2 года назад

      @UCKyTTBdDH3I%F0%9F%98%87635HQMrPvz_A Completely agrees every person has their own view to look at the problem and give the solution accordingly 🙂

  • @chiragkarnwal6740
    @chiragkarnwal6740 2 года назад +1

    Thanks sir very helpful video 😊❤️

  • @akankshagaur845
    @akankshagaur845 9 месяцев назад

    can we get the source code link as well @Riddhi Dutta

  • @rohitshaw6862
    @rohitshaw6862 2 года назад +4

    Also can you please wrap the whole content in single playlist, so it will be easier for me to track all the videos. Thank You.

    • @rite2riddhi
      @rite2riddhi  2 года назад +2

      Sure

    • @chetanpareek4428
      @chetanpareek4428 Месяц назад

      ​@@rite2riddhi can you please provide the gjithub link of this code ?

  • @raginibhadani7257
    @raginibhadani7257 Год назад

    Is this code available somewhere?

  • @vishalmishra1937
    @vishalmishra1937 Год назад

    plz share the code link

  • @rakeshpramanik
    @rakeshpramanik Год назад

    Wow

  • @debmalyapan53
    @debmalyapan53 2 года назад +1

    also plz make a video on elevator, distributed cache, splitwise. 😁

    • @rite2riddhi
      @rite2riddhi  2 года назад

      Next singleton then elevator

    • @Lucifer-xt7un
      @Lucifer-xt7un 2 года назад

      @@rite2riddhi bro please maintain consistency in this series and increase frequency of making videos

  • @sayankarmakar13
    @sayankarmakar13 6 месяцев назад

    It will be very helpful when you share the github link

  • @meme_engineering4521
    @meme_engineering4521 2 года назад

    bhai i wanted to ask, how important is LLD for freshers? and especially for campus placements

    • @rite2riddhi
      @rite2riddhi  2 года назад

      Not that important but good to know before joining any company

    • @meme_engineering4521
      @meme_engineering4521 2 года назад

      @@rite2riddhi okay, thanks

  • @kumarabhishek6777
    @kumarabhishek6777 8 месяцев назад

    you explain nicly but i am getting error in this ,,,, might be missing something so if possible provide the source code of the pattern

  • @ManeyyNeg
    @ManeyyNeg 2 месяца назад

    pls share github link

  • @vinamrasangal8436
    @vinamrasangal8436 19 дней назад

    give code plz

  • @thesoftwareengineer17
    @thesoftwareengineer17 Год назад

    bro plz add github links for all these questions too

  • @lokey8084
    @lokey8084 10 месяцев назад

    This feels like it breaks Liskov's substitution principle

  • @digitaljunk
    @digitaljunk Год назад

    To reduce echoing and delay in the recording point the microphone opening towards the sound source (your mouth). Please don't record the room space.

    • @rite2riddhi
      @rite2riddhi  Год назад +1

      Hey this is an old recording. Sound is sorted now.

  • @Mukeshkrk108
    @Mukeshkrk108 Год назад

    sir MIke and Voice is not clear and Sir on more thing that is You talking very fast

  • @cj-nr5ni
    @cj-nr5ni 10 месяцев назад

    Dude

  • @user-vv4rp9uv5d
    @user-vv4rp9uv5d 4 месяца назад

    I guess you could have improved the design more by not create Objects of each state

  • @aditigupta6870
    @aditigupta6870 3 месяца назад

    Why are you unnecessarily violating interface segregation just to explain a state design pattern?

  • @ratimohan5765
    @ratimohan5765 Год назад

    You explain very fast, need extra effort to understand. Didn't like this tutorial.

    • @rite2riddhi
      @rite2riddhi  Год назад

      Oh so sorry to hear that.. I would try to be slow from next time. You can watch it at 0.75x for now.

    • @no_name45689
      @no_name45689 Год назад

      Exactly.