Adapter Design Pattern

[ad_1]
Get the Code:

Best Design Patterns Book :

Welcome to my Adapter Design Pattern Tutorial! This is a very easy design pattern to grasp and put into use.

This pattern is used when you want to translate one interface of a class into another interface. Now, it makes sense that these 2 interfaces are compatible otherwise the pattern may not make sense. To accomplish this, all you need to do is bridge the differences using our old friend composition again.

Watch the video and look at the code and you’ll get it.


Posted

in

by

Tags:

Comments

35 responses to “Adapter Design Pattern”

  1. Edward Ryklin Avatar

    Hi Derek,

    To fully appreciate the advantages of this design pattern, I believe, it is best to declare the rx7Tank as an EnemyAttacker rather than EnemyTank. This way, the base pointer is the same for the robot and the tank.

  2. Alan Meile Avatar

    at last someone capable of explaining this pattern to me.. the robot story did the trick. Ty

  3. Besiktas7Bjk7 Avatar

    This "Like or Hate?" note, which appears in the bottom at some time is just perfect for youtube videos. You make sure to show us a way we can support you if we liked it, but don't waste precious explenation time for that. When ever someone says in the middle of the video "If u liked this video…" I instantly hate this guy. Well done on that one. I always like when i see it.

  4. Mariama Bundu Kamara Avatar

    Hello, this video is very good and understandable but i still have a problem. I need to program a Java project for Uni to show what the usage of the Adapter Patter is and explain in a presentation what the difference is to the Bridge Pattern. The problem is i still dont get the difference between them two. Can you please explain it to me.

  5. mitaanshu agarwal Avatar

    Software engineering is incomplete if you haven't spent hours on this channel.

  6. G.I. qhrrkfl Avatar

    feels bad about paul mate.

  7. PinkPonyOfPrey Avatar

    Aaaawwww! I still have my old rx7 on my desk over theeeeere!i
    It's a Yamaha RX7 drum machine from the eighties … built like a tank actually haha! ๐Ÿ˜€

    And yeah! I've been doing PHP with OOP (kind of) for a while now and with a big pile of code I need to untangle this is the first pattern I check and the explanation is great but not what I need. I've seen this video series before more or less just dry watching it but now I need it and it makes more sense. I've 25 videos to rewatch … * deep breath * … cover me, I'm going in! ๐Ÿ˜€

  8. moon sun Avatar

    you can use github to save the source code thanks

  9. moon sun Avatar

    can you make sustitle for your videos

  10. Suman G Avatar

    5 years old video and you r still one of the best when it comes to Java tutors on YouTube !!

  11. Chasen Bettinger Avatar

    What is the purpose of having the adapter? Is it because you could ultimately make different adapters for different platforms (i.e. tank, robot, jet)? Why wouldn't you just create classes for each different object and manipulate their components through getter and setter methods?

  12. skank hunt 42 Avatar

    In class we saw this pattern differently. No composition was used but instead the adapter inherits from the adaptee. :S

  13. Mohammed Sultan Avatar

    Excellent…
    but sometimes you need to slowdown ๐Ÿ™‚
    Thank you

  14. krishan kant gangwar Avatar

    hey Derek…Can you please share UML diagram of adapter design pattern for the given example….

  15. Chris Graham Avatar

    Derek – You've made this and the other patterns accessible by mortals. Thanks ever so much!

  16. Kris Nguyen Avatar

    tks u so muchhhhhhhhhh !!!!

  17. scarlaticious Avatar

    Great video! I feel like I finally get it

  18. popopo Avatar

    You saved my life with your videos. I am totally going to pass my data structures exam tomorrow! And it's all thanks to your videos about patterns!!! THANKS!!!

  19. Cristobal Gallegos Avatar

    Almost every time I need a tutorial on CS related topics, I find one of your videos. I am immediately relived since you are a master, and provide the information in a pristine manner. Thank you for all your time and help!

  20. billyblackburn87 Avatar

    why bother with an interface in the first place

  21. Abhishek Bachchan Avatar

    In the TestEnemyAttackers class, shouldn't the reference be EnemyAttacker for the EnemyTank object for it to make sense? I mean shouldn't it be:
    EnemyAttacker rx7Tank = new EnemyTank(); ???

  22. Mohammad Saif Avatar

    Good job and great work done by you with no words from me .

  23. Jean Mary Borgella Avatar

    Sir Derek, A cup of coffee isn't enough to thank you before your videos i was mediocre and now my teacher is telling how good i'm and i know it's your video's effect. I' m ending my bacc and everything become so easy for me. Thanks a lot.

  24. Abdul Wahab Avatar

    Can I have the slides ?

  25. Carlos Vizcaino Avatar

    Hey, Derek.

    How is the Adapter different from Proxy Design Pattern. Thanks.

  26. Mayur Kulkarni Avatar

    Thanks for the superb video ๐Ÿ™‚

  27. Muhammad Adnan Akmal Avatar

    Derek Banas Thanks sir awesome explanation i don't have words to express my gratitude you are The Father of Design Pattern
    (y) (y) (y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)(y)

Leave a Reply

Your email address will not be published. Required fields are marked *