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

  Рет қаралды 22,693

Riddhi Dutta

Riddhi Dutta

Күн бұрын

Пікірлер: 72
@vatsalmaheshwari692
@vatsalmaheshwari692 2 жыл бұрын
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.
@rohitshaw6862
@rohitshaw6862 2 жыл бұрын
A much needed content. Very few people are there who create videos on this topic. Thank you for your initiative 😁.
@rite2riddhi
@rite2riddhi 2 жыл бұрын
Pleasure
@rohitshaw6862
@rohitshaw6862 2 жыл бұрын
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 жыл бұрын
Sure
@chetanpareek4428
@chetanpareek4428 7 ай бұрын
​@@rite2riddhi can you please provide the gjithub link of this code ?
@debmalyapan53
@debmalyapan53 2 жыл бұрын
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 жыл бұрын
Thank you ❤️
@vinamrasangal8436
@vinamrasangal8436 7 ай бұрын
how can a person write such a big LLD code in just 1 hr ???
@fares.abuali
@fares.abuali 2 жыл бұрын
Thank you so much, Mr. Riddhi. Consie & Informative
@sarfrazz34
@sarfrazz34 2 жыл бұрын
Riddhi, could you please share the git repo link for the same?
@chetanpareek4428
@chetanpareek4428 7 ай бұрын
@Riddhi could you please share the github link of this code ?
@aishwaryapani4662
@aishwaryapani4662 2 жыл бұрын
Very helpful video, at a time when there is a dearth of LLD resources. Thank you for making these ❣
@Kapil_Sharma_Engineer
@Kapil_Sharma_Engineer 2 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@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 🙂
@abhishekrai5212
@abhishekrai5212 2 жыл бұрын
I really liked the design as well as the explanation. Please create more such LLD design content👍
@rite2riddhi
@rite2riddhi 2 жыл бұрын
Thanks abhishek
@Anonymous____________A721
@Anonymous____________A721 4 ай бұрын
Thanks GOAT
@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?
@rite2riddhi
@rite2riddhi 2 жыл бұрын
Right.
@soumyarv4018
@soumyarv4018 2 ай бұрын
Can you please explain any idea on how to implement online payment in place of adding a coin .
@sudipasarkar7981
@sudipasarkar7981 2 жыл бұрын
Amazingly explained much needed one😃😇
@rite2riddhi
@rite2riddhi 2 жыл бұрын
Thank you
@rishav144
@rishav144 2 жыл бұрын
need more LLD videos like this ....please
@zahidkhan-ln3jv
@zahidkhan-ln3jv 2 жыл бұрын
Great explanation! Can we use the same design pattern to design a shopping cart?
@chiragkarnwal6740
@chiragkarnwal6740 2 жыл бұрын
Thanks sir very helpful video 😊❤️
@rite2riddhi
@rite2riddhi 2 жыл бұрын
Pleasure
@dopamine003
@dopamine003 Жыл бұрын
Great explanation
@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.
@tanveer.shaikh
@tanveer.shaikh 2 жыл бұрын
instead of throwing illegal state can we sent some warning and be on same state
@divyajyotibasu3001
@divyajyotibasu3001 Жыл бұрын
Hi, Thanks for the helpful tutorial. If possible kindly share the codebase in a repository. Regards!
@debmalyapan53
@debmalyapan53 2 жыл бұрын
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
@Maneeshce2007
@Maneeshce2007 Жыл бұрын
Where is the github url to find the code ??
@akankshagaur845
@akankshagaur845 Жыл бұрын
can we get the source code link as well @Riddhi Dutta
@nikhilk4735
@nikhilk4735 2 жыл бұрын
Great explanation. Can you please share link to this code repo
@pratosh
@pratosh Жыл бұрын
is there any github repo for this design?
@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.
@digitaljunk
@digitaljunk 2 жыл бұрын
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 2 жыл бұрын
Hey this is an old recording. Sound is sorted now.
@chodingninjas7415
@chodingninjas7415 2 жыл бұрын
Great stuff
@sayankarmakar13
@sayankarmakar13 Жыл бұрын
It will be very helpful when you share the github link
@iamdips00356
@iamdips00356 2 жыл бұрын
Amazing video
@raginibhadani7257
@raginibhadani7257 2 жыл бұрын
Is this code available somewhere?
@satyajeetkumarjha1482
@satyajeetkumarjha1482 2 жыл бұрын
Can you post the link to GitHub repo?
@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 Жыл бұрын
you explain nicly but i am getting error in this ,,,, might be missing something so if possible provide the source code of the pattern
@hell-o8470
@hell-o8470 2 жыл бұрын
where can i get the code?
@JigyasaGupta-nx9pk
@JigyasaGupta-nx9pk 2 жыл бұрын
do u have a git hub link
@vishalmishra1937
@vishalmishra1937 Жыл бұрын
plz share the code link
@lokey8084
@lokey8084 Жыл бұрын
This feels like it breaks Liskov's substitution principle
@thesoftwareengineer17
@thesoftwareengineer17 2 жыл бұрын
bro plz add github links for all these questions too
@vinamrasangal8436
@vinamrasangal8436 7 ай бұрын
give code plz
@ManeyyNeg
@ManeyyNeg 8 ай бұрын
pls share github link
@Mukeshkrk108
@Mukeshkrk108 2 жыл бұрын
sir MIke and Voice is not clear and Sir on more thing that is You talking very fast
@rakeshpramanik
@rakeshpramanik 2 жыл бұрын
Wow
@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.
@cj-nr5ni
@cj-nr5ni Жыл бұрын
Dude
@aditigupta6870
@aditigupta6870 9 ай бұрын
Why are you unnecessarily violating interface segregation just to explain a state design pattern?
@RishabAgarwala
@RishabAgarwala 11 ай бұрын
I guess you could have improved the design more by not create Objects of each state
7 Design Patterns EVERY Developer Should Know
23:09
ForrestKnight
Рет қаралды 282 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 62 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
State design pattern | Design an ATM | Low Level Design
1:04:05
Programming Pathshala
Рет қаралды 4,6 М.
ATM LOW LEVEL DESIGN | FACEBOOK INTERVIEW QUESTION | SOFTWARE DEVELOPER INTERVIEWS
19:24
Master the Fluent Builder Design Pattern in C#
15:05
Milan Jovanović
Рет қаралды 30 М.
System Design Mock Interview: Design a Vending Machine
18:44
Exponent
Рет қаралды 42 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН