31. Design Undo, Redo feature with Command Pattern | Command Design Pattern| Low Level System Design

preview_player
Показать описание
Notes: 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 perks:

#softwareengineer #systemdesign #designpatterns #lowleveldesign
Рекомендации по теме
Комментарии
Автор

One thing I like about you is that you try your best to give attention to all the posted comments/questions.
Other youtubers just ask audience to like and subscribe.

prafullaingole
Автор

I was comparing this design pattern over the internet and by far your explanation has been the best with nice visual diagrams. ore power to you brother!

prakash
Автор

Thanks for the video.

The Undo Operations needs to be clearly explained by Interviewer, as Undo May mean not just Inversion of Last Operations But also Performing the Operation that was prior to current operation.
Example :

Turn AC on
SetTemp
Undo

So at last Undo might refer to revert of last Operation i.e. set Temp and hence implementation could change as per this.

theunusual
Автор

I was reading the head first book and couldn't understand this topic, thank you I finally got it.

Rabbitv-rs
Автор

It will make more sense to accept command as method argument in MyRemoteControl instead of constructor arg otherwise every time I need to execute a method(command) I need to create 2 extra objects ie 1 MyRemoteControl 2. Command.

dhaanaanjaay
Автор

LLD and HLD is soo interesting because of you 🙃 .Happy Coding

vishalghanghav
Автор

Will using DLL make more sense in place of stack - as we have no control over size of stack; with DLL we can insert commands from one side and remove commands from the other side ( if undo DLL size grows beyond initial capacity, let’s say we only want to store last 5 commands) ?

shubhamtripathi
Автор

For undo redo, isnt memento pattern more suitable?

dhaanaanjaay
Автор

Thanks for the great explanation! I have one query

If we want to also provide the setTemperature(int temp) to the client, I can think of 2 solutions:

1. Have one more method execute(int temp) in the command interface to support the setTemperature(), but TurnACOffCommand and TurnACOnCommand will have to unnecessarily implement the execute(int temp) method.

2. Have one more command interface which will have execute(int temp) and the SetTemperatureCommand will implement this interface while the existing TurnACOffCommand and TurnACOnCommand will implement the first command method.

What should be the ideal solution for this usecase?

RaviShankar-rjxq
Автор

Hi bro, Excellent content, I have one doubt, if we have multiple commands to call like stop, play, increase, decrease, etc so do we need to call each command individually for that like that:
Inside static main(){

remoteobj.setcommand(new stop(Television tv));
remoteobj.setcommand(new play(Television tv));
remoteobj.setcommand(new increase(Television tv));
remoteobj.setcommand(new decrease(Television tv));

} // because in this way it will override the remoteobj.pressbutton(), Is this the right way or do we bind it to the input we are selecting?

vikalpsingh
Автор

I love LLD more than HLD, Keep LLD coming <3

AkashJadhavIT
Автор

​ @ConceptandCoding why facade cant be used here, ? is also undergo similar purpose, please explain

ayushbhanu-cj
Автор

thank you sir,
Understood concept Fully

ramoverload
Автор

Very nice video sir ❤

I guess Doubly linked list is more helpful here in case of remote control buttons. Can insert from rear end and remove from front end or rear end only as per requirement.

Thanks again !!

tejasshaha
Автор

sir 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 plz reply sir

yuvhrajverma
Автор

I don't understand its usecase. Didn't we use facade to provide abstraction to the client and club multiple actions?
Can't we use strategy pattern to decide what to do?
Regarding undo, I can't think of a real time production issue. I will search for it though.

arpitkansal
Автор

Thanks for great content .Appreciate your efforst👍👍🙏

shrutimath
Автор

try to tell beforehand what you are actually building so we can check what is wrong with the given solution at an early stage.

namandave
Автор

Recently you have changed the notepad . Which is this android or iPad . Looks nice. Please suggest me . I want to use for note taking.

swapnajitpanda
Автор

17:54 client still has to know about all the commads it can perform
i do not think this pattern makes any sense
or maybe the example is not good

chandlerbing
welcome to shbcf.ru