first of all, both can be used together, you use the command pattern to encapsulate some functionality of an object in a class and u use an invoker to trigger this functionality, so as we said if you have a tv class instead of putting turnOnTV function inside tv class, you will create a turnOnTV command and an invoker to invoke these commands, on the other hand you will use memento design pattern to save the state of the tv so you can undo it, as an example if the invoker invoked turnOnTV command, the state of the tv will be ON , then using the memento you can undo the command and turn it off as the last state before turning it on was off, I hope this makes things clear, if it's not clear yet tell me and I'll try to explain with another example, also sorry for replying in English as I cannot write both Arabic and English in one Comment
@@devgeeksacademy3340 Replying in English is perfectly fine with me. Thanks for your explanation 😊 What you said about the coupling of the Command and the Memento patterns, I used to think it is all related to the command pattern alone! I'm glad you clarified this for me.
شرح بسيط و رائع يا باشمهندس
فى انتظار المزيد من الدروس و جزاك الله خيرا
شكرا لحضرتك ده من فضل ربنا عليا
مجهود ممتاز
وعرض شيق غير ممل
تسلم ايدك
شكرا جزيلا لحضرتك
جزاكم الله خيرًا
شرح استثنائي 🎖️❤️💯
شكرا جزيلا لحضرتك هذا من فضل الله
بارك الله فيك يا باشمهندس
وفيكم يارب شكرا جدا لحضرتك
طيب إيه الفرق بين Memento design pattern و Command design pattern؟
first of all, both can be used together, you use the command pattern to encapsulate some functionality of an object in a class and u use an invoker to trigger this functionality, so as we said if you have a tv class instead of putting turnOnTV function inside tv class, you will create a turnOnTV command and an invoker to invoke these commands, on the other hand you will use memento design pattern to save the state of the tv so you can undo it, as an example if the invoker invoked turnOnTV command, the state of the tv will be ON , then using the memento you can undo the command and turn it off as the last state before turning it on was off, I hope this makes things clear, if it's not clear yet tell me and I'll try to explain with another example, also sorry for replying in English as I cannot write both Arabic and English in one Comment
@@devgeeksacademy3340
Replying in English is perfectly fine with me. Thanks for your explanation 😊
What you said about the coupling of the Command and the Memento patterns, I used to think it is all related to the command pattern alone! I'm glad you clarified this for me.
@@AserAhmad You're welcome anytime.
❤️