Command Pattern - Design Patterns (ep 7)

Sdílet
Vložit
  • čas přidán 13. 07. 2017
  • Video series on Design Patterns for Object Oriented Languages. This time we look at the Command Pattern.
    ► The playlist
    • Design Patterns in Obj...
    ► Head First: Design Patterns
    geni.us/nlbA6
    ► Design Patterns: Elements of Reusable Object-Oriented Software
    geni.us/PsXmo
    TALKS MENTIONED
    ► Gary Bernhardt - Boundaries
    • Ruby Conf 12 - Boundar...
    PRODUCTS MENTIONED (Not paid endorsement but affiliate links)
    ► Philips Hue (Starter Kit)
    geni.us/ejJX
    I recommend buying more lightstrips than light bulbs :)
    💪 Patreon Community
    / christopherokhravi
    📚 Products I Recommend
    geni.us/71ZXF

Komentáře • 503

  • @Mikenight120
    @Mikenight120 Před rokem +16

    2023 and still one of the best Design Pattern Playlists.

  • @AlfW
    @AlfW Před 4 lety +90

    Student: Can we do this one by one?
    Christopher: Yes, let's do it one by one by one by one.

  • @MGJoe93
    @MGJoe93 Před 2 lety +57

    Your design pattern playlist is one of the best explanations about patterns ever. The last video of this playlist is over 4 years old and there are many patterns left (visitor, chain of responsibility, flyweight, builder, etc.). Are there any plans to cover these ones? It would round this awesome playlist more up :)

  • @RajivKumar-qj9nw
    @RajivKumar-qj9nw Před rokem +8

    It's been more than 5 years for this video yet no one has ever touched your level of explaining things. Simply a gem. It's high time now , please make more such videos.

  • @AbhishekKumar-xh6pi
    @AbhishekKumar-xh6pi Před 7 lety +141

    In my youtube browsing career of 9+ years,this is the first channel/video where I am commenting and liking.
    You really deserve this.Hats off to you Christopher Okhravi

    • @ChristopherOkhravi
      @ChristopherOkhravi  Před 7 lety +12

      Thank you for sharing. I very much appreciate you taking the time to punch out that comment. I am humbled.

  • @timothyjohns8775
    @timothyjohns8775 Před 6 lety +134

    At around 25:20, Chris mentions that command pattern is similar to strategy pattern, and he wasn't sure what the technical difference was. To me, the difference is that in the strategy pattern, the object that gets passed around is an algorithm (i.e. HOW to do something). On the other hand, in the command pattern, the object that gets passed around is a command (i.e. WHAT to do).
    For example, let's say we have a list of elements. If we already know that we want to sort the list, we might use the strategy pattern to determine how to sort the list. On the other hand, we might use the command pattern to determine what operation to apply to the list, such as to sort the list, or to add an element, or to remove an element, etc.

    • @ribaker822
      @ribaker822 Před 5 lety +6

      I agree with this. And I see how the Command can then use the Strategy pattern within itself, to "execute" and "unexecute" depending on what that is.

    • @professorfontanez
      @professorfontanez Před 4 lety +23

      Well... in the simplest of terms, both are encapsulating BEHAVIORS. In one context (Strategy), you calling the behavior ALGORITHMS, and in this context (Command), the algorithm is the message or command. The only difference I see is that, for Strategy there is no requirement to undo something that was done in the past. You could say that the Command Pattern is an EXTENSION of the Strategy Pattern.

    • @bachihard
      @bachihard Před 4 lety +1

      I kinda agree with Professor F here. Command Pattern just feels like Strategy Pattern with an Undo operation.

    • @immapartain4712
      @immapartain4712 Před 4 lety +2

      I can also see that a subtle difference might be the way the client (Invoker in this case) is using the commands. For instance the order of commands generally matters, so the Invoker would keep track of the commands if they wanted to Undo commands in the order of which they were last executed. While in the Strategy Pattern, clients typically do not need to maintain a collection of strategies where order matters. Of course this is all depending on the scenario. Of course you could create composite hierarchies for both commands and strategies, and then again commands can contain a strategy. So it really all depends on the scenario, but I think in the simplest example we are keeping track of what to either do or undo in relation to the order in which the commands were executed.

    • @TooNDeMentIa
      @TooNDeMentIa Před 4 lety +8

      Strategies aren't really meant to be passed around, stored, sent over the network, reversed etc. Commands are.
      It's the data the command contains, sometimes just the command itself, that defines _what_ should be done and the execute function defines _how_ it should be done.

  • @MichaelKire
    @MichaelKire Před 3 lety +11

    I wish I had these videos back when I studied CS.
    You show off everything about the patterns. The What, the How and the Where. Some of these patterns I fully understand now, 8-10 years later.

  • @Bigboi0330
    @Bigboi0330 Před 7 lety +261

    You deserve more subs man. One of the few people I can actually stomach when talking and design patterns.

  • @ivanbartolelli
    @ivanbartolelli Před 5 lety +7

    I'm from Argentina, and I'm studying Information Systems Engineering , and in systems design subject my partners and me are studying Desing Patterns. Your explanations are great for us. Thanks a lot!

  • @Iboshido
    @Iboshido Před 3 lety +2

    Trough out the years i always come back to this channel when it comes to patterns. Noone explains it close as well as you do. Thank u alot

  • @TheChodex
    @TheChodex Před 4 lety +2

    I could listen to you talk about Design Patterns forever!

  • @SpoderSuperhero
    @SpoderSuperhero Před 3 lety +9

    THis is really, really good content. I love how you discuss your own opinions on how these patterns are constructed.

  • @MazDTdK
    @MazDTdK Před 3 lety +6

    Christopher in 2017: One half is the office part and other half is the leisure part of your room.
    2020: Yes

  • @FlipYourLearning
    @FlipYourLearning Před 2 lety +11

    Wonderful! I'm trying to learn to program and I was deferring learning about design patterns because they seemed too complicated. Your videos have changed my mind and I am managing to understand every single one of them.

  • @kevinbenavides92
    @kevinbenavides92 Před 6 lety

    Thank you Chris. I was afraid of tackling design patterns as a self taught but you have made this portion of the journey so much easier. Keep going man. Your amazing!

  • @KeyvanGarage
    @KeyvanGarage Před měsícem

    This is "Mr Bean" 30 years younger teaching Design patterns! Good job on your videos 💯

  • @Floetism
    @Floetism Před 3 lety +2

    This was so good I feel genuinely mind-blown! The command pattern is crazy powerful

  • @tivmego
    @tivmego Před 7 lety +22

    I knew you won't fail us man! I was waiting for the next one since the last dp video :)

  • @danielwagner9691
    @danielwagner9691 Před 4 lety +2

    Спасибо большое Christopher. У тебя хорошо получается объяснять такие сложные темы простыми примерами из жизни. Как раз то что я искал. Удачи тебе.

  • @atul121984
    @atul121984 Před 6 lety

    I am impressed by the way you make us understand 'Design patterns'. Thanks a lot Christopher Okhravi

    • @ChristopherOkhravi
      @ChristopherOkhravi  Před 6 lety

      Not a problem. I’m glad to have been useful :) Thank you for watching and for your comment :) :)

  • @praneetgupta5121
    @praneetgupta5121 Před 6 lety +5

    I studied few patterns from your video only and they were asked in an interview...followed your style of explaining the patterns and I got selected..thanks man. Your knowledge inspires and motivates me to learn more. ✌

  • @indramaniarora7901
    @indramaniarora7901 Před 4 lety

    Best series on design patterns on youtube

  • @federicomagini614
    @federicomagini614 Před rokem

    I've been watching 20+videos these days to get this pattern, this is the one that made me understand what it is !!! thank you so much

  • @bryanexcell3751
    @bryanexcell3751 Před 7 lety

    I really want to say thank you so much. I don't learn from just reading books very well but I can learn great from fantastic lecturers such as yourself. I've actually read this book but my understanding of design patterns has increased so much from your videos. Thank you. Really I mean it, thank you so much. You have helped me become a much better developer.

  • @parasgarg7139
    @parasgarg7139 Před 2 lety

    Thanks, Christopher, it was a wonderful explanation. I have started this Design Patterns playlist a few days ago and I got addicted to it as you made them so easy to understand.

  • @omerwaseem9305
    @omerwaseem9305 Před 7 lety

    I've been waiting for the next instalment in the design pattern series. Love and appreciate your videos!

  • @KishoreKumar-pf8ku
    @KishoreKumar-pf8ku Před 3 lety

    Best series on Design Patterns. Binge-worthy. Thanks a lot.

  • @amisorvoja6443
    @amisorvoja6443 Před 5 lety

    I really appreciate this series. I prefer this before any other series in Netflix 😎 You make me laugh loud and in the same time give me understandable patterns ✌🏽

  • @boburirgashev4762
    @boburirgashev4762 Před 3 lety

    You saved my life. Thank you for the series on design patterns. You are really good at explaining things

  • @hernan4485
    @hernan4485 Před 5 lety +4

    thanks man really helped me out. Really chill way of explaining things

  • @AbdAllahBoda
    @AbdAllahBoda Před 2 lety

    Only of the super rare videos that I watch at normal speed, which tells you a lot. :)

  • @Bl0ck3dz
    @Bl0ck3dz Před 5 lety +64

    21:09 you alright my man? :D

  • @therandomfactsrealm
    @therandomfactsrealm Před 3 lety +1

    I'm new to design pattern and at the end I was like, "yoooooooo!!! This is amazing!!! Where do I start 👀👀? “ Your episodes on these are awesome. I love how you explain these in several examples and in different view points along with real world applications and most of all the example of code. This is how I learn and I wish I had someone to explain things to me in the way you do. Thanks 😉👌👍👍

  • @jeanahollings
    @jeanahollings Před 6 lety

    Thank you! Thank you! Thank you! I am an auditory learner which is a very serious challenge to learning programming. I've read the books, read the sites, and watched a few other videos to try to understand this pattern to no avail. Within 5 minutes of watching this I understood more than all those other resources combined. Don't change a thing! I know visual learners may not appreciate your work the way I do but I also know that the resources out there are hand made for them.

  • @danielgallegosibarra7169

    I built an AT Command Builder in order to build specific routines to program a network module. I didn't know that was a design pattern. My head exploded with this awesome video! :) Thank you, Christopher! amazing videos!

  • @jackwesleymoreira
    @jackwesleymoreira Před 2 lety

    Man I'm really amazed with this explanation!! Mind blowing!!! If I could put all my former university teachers to give a class like that, they wouldn't be capable to do it... Congrats Christopher, you are doing an amazing work...

  • @TheVoltarus
    @TheVoltarus Před 3 lety

    Videos like yours make me wonder why I even bother with most of my uni classes where the explanations are often unclear.
    This is so well explained and it probably saved me a few hours of studying. Thanks!

  • @MyroslavOhorodnyk
    @MyroslavOhorodnyk Před 4 lety

    A great approach to explanation, MR Okhravi!
    Thanks for the video!

  • @thijsk347
    @thijsk347 Před 6 lety

    I really love your way of explaining man, it's simple and you cover all the important stuff. I subbed!

  • @craiglehn
    @craiglehn Před 5 lety

    Thank you man, never had time to finish reading this, book and yeah, you explain it will enough that I can follow and not trail off.

  • @jsharick7
    @jsharick7 Před 8 měsíci

    I was really struggling to wrap my head around this one, just because there is a lot of verbiage thrown around very quickly, making it hard to latch onto anything in every other explanation. I really needed the time you took to break out down, rephrase sentences, etc. It's much simpler than everything else made it seem! Thank you so much for making this!

  • @experimentalhypothesis1137

    best series on patterns online

  • @taranjitkaur9036
    @taranjitkaur9036 Před 2 lety

    I like your way of teaching. Thanks a ton for making things simpler. You rock!!

  • @jayamalw
    @jayamalw Před 2 lety

    This is the super easy to grasp man.... I'm watching this now, after learning Design patterns before 10+ years back.. I worry, I didn't have CZcams and videos like yours in those days.

  • @ozziekhoo
    @ozziekhoo Před 3 lety +3

    I am about to start my next semester learning all these patterns. Thank you for covering them! Also 21:10 was seriously hilarious! You're comedic skills are on point!

  • @PrafulPatelcontact2praful

    Christopher, you are an awesome tutor, great explanation, and feels having discussion realistic and face to face, Thanks... Please keep it up

  • @saurabhsuman4960
    @saurabhsuman4960 Před 5 lety +1

    Love your videos and way of explaining it. I have confidence that now I can also learn design patterns.

  • @sirrobert4820
    @sirrobert4820 Před rokem

    you definitely are the best lecturer/teacher I have ever seen .... so brilliant

  • @jakubczechowski1159
    @jakubczechowski1159 Před 3 lety

    For me this series is extremely useful. Thank you!

  • @gonzaloibarsingman7379

    A crystal clear explanation, well done! Videos length don't matter when video is rich in content

  • @sankait3036
    @sankait3036 Před 3 lety

    Was struggling with the Command pattern until I found your video, very clear explanation. Thank you so much!

  • @samirswain8457
    @samirswain8457 Před 5 lety +1

    I'm pretty late to comment, but just saw these videos. WONDERFUL! one of the best I've even come across. Thank you so much Sir.

  • @Julio-cu2hd
    @Julio-cu2hd Před 6 lety

    awesome! I begin to love design patterns after seen your good explanations! great job!

  • @sayalithange9231
    @sayalithange9231 Před 4 lety +4

    You are just awesome....I'm very new to design patterns...and this video really helped me understand...Thanks alot...😊😊

  • @Callerooo
    @Callerooo Před 6 lety +1

    Thank you so much for all your videos. They are VERY helpful along with reading the book

    • @ChristopherOkhravi
      @ChristopherOkhravi  Před 6 lety

      +Callerooo Thank you. I'm glad to hear that the videos help support the literature :) Thank you for watching and for commenting! :D

  • @avantikavyas1236
    @avantikavyas1236 Před 6 lety +2

    Your way of teaching is simply superb! :D Keep up the good work! :)

  • @MrPDTaylor
    @MrPDTaylor Před 5 lety

    Thanks so much for this video. I just started working through Head First Design patterns and you are helping me expodite the process (I'm not a big fan of reading to learn programming simply because audio is more efficient)

  • @ravi-thestar8501
    @ravi-thestar8501 Před 5 lety +1

    great work bro.. I am an experienced developer without much knowledge on design pattern. I tried many tutes, but yours is the best. thank you very much

  • @leonardodavinci4259
    @leonardodavinci4259 Před 2 lety

    Thank you very much for the lucid explanation!

  • @balajim6628
    @balajim6628 Před 5 lety

    Very well explained. Able to understand the command pattern with clarity. Thanks a lot.

  • @mishamovdivar
    @mishamovdivar Před 7 lety

    Please continue the series man. great explanations.

  • @jesiooooo
    @jesiooooo Před 11 měsíci

    Thank you for this film and every other. Great job 😊

  • @bbabak2
    @bbabak2 Před 3 lety

    Superb explanation! Thank you so much!

  • @dhruvachandra8210
    @dhruvachandra8210 Před 5 lety

    Please complete all design patterns not only the ones covered in Head First Design Patterns, but your videos are also so good I really love these design pattern videos a lot

  • @marcpijnappels1351
    @marcpijnappels1351 Před 7 lety +1

    When they print a new edition of the book they should reference to this series :)
    Very well explained. Like the way you present the topics. Respect.
    Can't wait for the next one...

  • @TheToffeyman
    @TheToffeyman Před 6 lety +1

    no man, you are TOTALLY AWESOME!!

  • @BinarySymphony
    @BinarySymphony Před 7 lety

    It's finally up. Liked before watching.

  • @xiuyanxin4339
    @xiuyanxin4339 Před 7 lety +1

    Thank you for the AWESOME videos! Really helped me a lot!

  • @ianjamiesonmusic
    @ianjamiesonmusic Před 7 lety

    What a guy offering this advice for free!

  • @mrrule8311
    @mrrule8311 Před 5 lety +5

    Second time i watch this. Great explanation and real example !! :) Like i heard good material always should be inspected twice, because you want to get all information clear.

  • @simondavis1303
    @simondavis1303 Před 3 lety

    Another example would be building a calculator:
    We have multiple Commands: Add, Subtract, Multiply, Divide, Redo, Undo
    We have a Calculator which has buttons that invoke these commands.
    Then our receiver which is the display, shows the results of those commands.
    I'm loving these videos! Starting to see the world in a brand new way! Thank you so much!

  • @SaurabhGuptaicecool
    @SaurabhGuptaicecool Před 4 lety

    Thank-you sir for the series.

  • @orc_spearman
    @orc_spearman Před 5 lety

    Thanks for this playlist. I find it extremely useful

  • @muho121
    @muho121 Před 7 lety +62

    Great explanation! I have been watching this series and so far this one is the first to make me actually laugh out loud :D 21:09

    • @ChristopherOkhravi
      @ChristopherOkhravi  Před 7 lety +22

      Heheh :) It was actually worse but I felt too much like a buffoon and had to cut the rest of the fall out :D

    • @SaravanaKumar-nl4sz
      @SaravanaKumar-nl4sz Před 7 lety +8

      Once this entire patterns episode done. You could post that videos as bloopers :P

    • @Ivo68
      @Ivo68 Před 6 lety +5

      he just showed the feature of redo. "so the command ..." redo() "so the command..."

    • @MathP3r
      @MathP3r Před 4 lety

      @@Ivo68 HAHAHHAHAHHAAHA

  • @theriddler2129
    @theriddler2129 Před 3 lety

    Excellent explanation! Thank you!!

  • @augusto2581
    @augusto2581 Před 3 lety

    Great Explanation Christopher! Thank you very much for this video!

  • @JarikKomarik
    @JarikKomarik Před 2 lety

    Amazing explanation, Thank YOU!

  • @richb4000
    @richb4000 Před 9 měsíci

    Hey Christopher, I'm new to C# and wanted to say a huge thanks for this video, its entertaining as well as educational - I can now follow some code at work and understand better - top job my friend !

  • @amerbashoeb2106
    @amerbashoeb2106 Před 2 lety

    Spent 30 seconds on this and immediately Subscribed.

  • @JoshuaLawrence124
    @JoshuaLawrence124 Před 5 lety

    Thank you so much for the explanation. Great work.

  • @neval7512
    @neval7512 Před 6 lety

    Now I don't need to get bored with the book.I get the point fast and furiously:) OK, I play the video in 1.5x speed sometimes, but you've done a GREAT JOB here. Thank you!

  • @demonspawn5967
    @demonspawn5967 Před 4 lety

    Your videos are great! They got me an A in my programming exam about Design Patterns :D! Well explained, easy to follow, and entertaining. Thank you

  • @ahmetozdemir2207
    @ahmetozdemir2207 Před 5 lety +2

    Another excellent explanation of design patterns. Thanks for these videos. By the way that 21:09 was amazing. I just rolled back to see that again :)

  • @thomasfgooch
    @thomasfgooch Před rokem

    this is so very enjoyable, I am having a great time reading this book and watching your videos. thanks!

  • @nitin_puranik
    @nitin_puranik Před 10 měsíci

    The beginning of these videos always makes me giggle with that goofy entry of yours 😂😂

  • @viteok1234
    @viteok1234 Před 6 lety

    Nice explanation, thank you for sharing with book titles in order to study it thorougher .

  • @harikrishna3656
    @harikrishna3656 Před 6 lety

    superb, simple, easy explanation. clearly understood the concept.

  • @littlemormonboy
    @littlemormonboy Před 3 lety

    Love these videos! They are very clear and useful

  • @iliqn20
    @iliqn20 Před 4 lety

    Amazing tutorial! Don't stop uploading : ) Subscribed!

  • @Laralamberts
    @Laralamberts Před 5 lety +4

    you ll most likely make me pass my exams with these clear explanations! Thank you

  • @rubanantony
    @rubanantony Před 4 lety

    Nice video. Thanks for explaining.

  • @tarunsharma6455
    @tarunsharma6455 Před 7 lety

    Waiting for next one ........ From a week.
    Thanks dude. I am able to finish half book in week. Really admire your work

  • @omotola9521
    @omotola9521 Před 6 lety

    Thank you very much been tryna understand this command but I feel this is the first time I actually got a good hang off it plus I think i am more likely a visual learner

  • @colorspace5541
    @colorspace5541 Před 3 lety

    The Thumbnail alone has earned my like!!!!

  • @hoelefouk
    @hoelefouk Před 4 lety +1

    your videos - totally awesome!

  • @afiq980
    @afiq980 Před 3 lety

    Thank you so much for this, very clear!

  • @upadhyayap1990
    @upadhyayap1990 Před 6 lety

    very nice and concise explanation.

  • @A_Z716
    @A_Z716 Před 6 lety

    I like each of your lessons. Thanks

  • @_Squiggle_
    @_Squiggle_ Před 10 měsíci

    Awesome video! Thank you so much!

  • @MathP3r
    @MathP3r Před 4 lety

    awesome video ! It really helped me out understand the command pattern. Thank you very much !