Adapter Design Pattern | Explanation with Code in Easy Way! ✌🏻

Поделиться
HTML-код
  • Опубликовано: 20 янв 2025

Комментарии • 50

  • @kishorepurswani1212
    @kishorepurswani1212 2 года назад +11

    Perfect example of adapter to introduce the topic

  • @mumtazirteqaahmed8553
    @mumtazirteqaahmed8553 Год назад +1

    Explanation was great, starting with a real world example then coding it and following up with a class diagram. Thank you!

  • @shivraj940
    @shivraj940 Год назад +4

    Mam, Please complete this course. I was interested to learn more on LLD from you. Its amazing!!

  • @kritangnasingh5934
    @kritangnasingh5934 Год назад

    I randomly came across this video and found it worth my time. So nicely you have explained i!

  • @handover007
    @handover007 Год назад

    Your explanation is really simple to understand. Please keep making such videos. Thanks a lot

  • @shivarajakumar9175
    @shivarajakumar9175 Год назад

    very useful and clear explanatoin. thankyou!

  • @HarshSharma-ff3ox
    @HarshSharma-ff3ox 2 года назад +1

    Very well explained. Understood it completely. Thanks for this tutorial 😊💯

    • @KeertiPurswani
      @KeertiPurswani  2 года назад +1

      Thank you so much! Means a lot! ❤️😇

  • @quadsoft7376
    @quadsoft7376 2 года назад

    What a way of explanation, i love your explanation, because often you co relate with some intresting example, Keep sharing such amazing content 🙏🙏🙏🙏🙏🙏🙏

  • @athifpasha3302
    @athifpasha3302 Год назад

    Excellent, It is very helpful design pattern videos, Waiting for other patterns - Facade and decorator and others.

  • @jenishadsouza907
    @jenishadsouza907 Год назад

    Thanks for the video! awaiting for the next video!

  • @shruthakeerthis4549
    @shruthakeerthis4549 2 года назад +2

    What if you have now a new format to be converted to JSON ?
    I think you need to have a parent class called "data" and derive "xmldata" and other new formats.
    And now, the the adapter class should have "data *" as member which calls getdata (overidden in xmldata and new formats class)

  • @abhinavshukla7630
    @abhinavshukla7630 2 года назад

    Not very much aware of such situations as I don't have much experience yet in software development but understood the topic really well, very well explained mam.💯💯

  • @DurgaPrasad-fm7lh
    @DurgaPrasad-fm7lh 16 дней назад

    Good example

  • @gopalsirotha
    @gopalsirotha Год назад

    Video was really helpful. Thank you 💖

  • @maheenazeez460
    @maheenazeez460 Год назад

    Good Explanation 👏

  • @pramodkumarkar6573
    @pramodkumarkar6573 5 месяцев назад

    Very Clear !!

  • @harshthakur1078
    @harshthakur1078 Год назад

    Very helpful. Thank you.

  • @arunprabhu123
    @arunprabhu123 Год назад +1

    can we create a object of baseclass(DataAnalyticsTool) with a derived class, instead we could have created an object of adapter class itself isnt it?

  • @durdensdream
    @durdensdream 2 месяца назад

    enchanté

  • @alans8771
    @alans8771 Год назад

    This was amazing, I am studying this pattern for python but you explained it so well I understood it perfectly, thank you so much, you got a new sub!

  • @zyx7955
    @zyx7955 2 года назад +2

    PLS REPLY 🙏: Mam i just saw ur interview/talk with Harnoor on his channel Singh in USA... U said u started coding very late and u wasn't from CS ... So if I get lower branch in NIT Calicut and I start coding from 1st year itself can I get better package or can I get into Maangn or any other big companies like Uber atlassian if I crack my interviews and prepare accordingly from start itself ??

  • @ShivamKendre-fc3su
    @ShivamKendre-fc3su 9 месяцев назад

    Awesome video didi

  • @yash_verma
    @yash_verma Год назад

    Make videos on remaining design patterns also (facade, strategy, decorator)

  • @herculean6748
    @herculean6748 Год назад

    Please make a video on the decorator pattern

  • @sumit455
    @sumit455 2 месяца назад

    But client still have to change the object creation. Kindly correct me if I am wrong

  • @matheens6689
    @matheens6689 2 года назад +1

    Hey ,really appreciate if you give idea on priority inversion , mutex and multitasking

  • @charuprabha9696
    @charuprabha9696 3 месяца назад

    where are facade and strategy design pattern videos? as mentioned in the last of this video

  • @seeker4430
    @seeker4430 Год назад +7

    If only you didn't use C++ and used more mainstream language like Java or C# it would be a lot more helpful

    • @aakashrana1524
      @aakashrana1524 Месяц назад

      Is C# really mainstream LOL

    • @seeker4430
      @seeker4430 Месяц назад

      @aakashrana1524 I don't know what cave you live in... More than half of all enterprise applications run on C#

    • @aakashrana1524
      @aakashrana1524 Месяц назад

      @@seeker4430 and other half of your world would be on java , 🤣

  • @tweenfun91
    @tweenfun91 Год назад

    Hi Keerti, Could you please let us know when you will upload videos for rest of the design patterns. I found these videos very helpful. If it takes time please let me know the other source from where i can learn rest of them. Please help

    • @KeertiPurswani
      @KeertiPurswani  Год назад

      Hey, most of the common patterns are covered. strategy is another imp one. Will cover that soon. But, The LLD lives should be more helpful I think

  • @singiri697
    @singiri697 Год назад

    Why should we use virtual?

  • @yashkhurana5204
    @yashkhurana5204 2 года назад +1

    thank you very much didi

  • @anchitbhushan6172
    @anchitbhushan6172 9 месяцев назад

    What if the DataAnalyticsTool class (the target class) is an external library and it does not allow itself to be inherited ?

    • @coolfyb
      @coolfyb 8 месяцев назад

      Then we’ll have to create Adapter class which will contain (Containment) DataAnalyticsTool, it will do the conversion (XML to JSON) and delegate (Delegation) processing to DataAnalyticsTool.

  • @tyrionlannister8268
    @tyrionlannister8268 Год назад

    How can i get this code?

  • @programwithdenis3643
    @programwithdenis3643 Год назад

    Would you mind doing same in java

  • @debmalyapan53
    @debmalyapan53 2 года назад +1

    di, when will the next video come out in code from scratch channel? 😴

    • @KeertiPurswani
      @KeertiPurswani  2 года назад +3

      Next 5 videos are recorded and in pipeline for editing. Will start uploading this or next week for sure!

  • @uttambhat4542
    @uttambhat4542 Год назад

    Shouldn't the adaptees specificRequest be called instead of converting XML to JSON?
    XMLData class needs a analyseXMLData(); which should be called when adapyer.analyseData() is called from the client?
    I guess we have to either write different functions to analyse different kinds of data(in different data classes) or write functions to convert different data types into XML(in different adapter classes)
    seems like writing different data classes is reusable too

  • @santoshs4393
    @santoshs4393 Год назад

    Thanks for Nice info about Adaptor pattern. Just a suggestion, It would have been easier to understand if you had written client code in separate file like your earlier videos.

  • @coolfyb
    @coolfyb 8 месяцев назад

    eXcellent’e

  • @mcq2427
    @mcq2427 20 дней назад

    Can you explain in java😢

  • @KolkanatBashpayev
    @KolkanatBashpayev 11 месяцев назад

    you are not correctly putting your classes into the diagram. Adaptee is not a XmlData class

  • @bhargavim9861
    @bhargavim9861 Год назад +1

    java code :
    import org.json.JSONObject;
    import org.json.XML;
    class XmlData {
    String xmlData;
    public XmlData(String xmlData) {
    this.xmlData = xmlData;
    }
    public String getXmlData() {
    return xmlData;
    }
    }
    class DataAnalysisTool {
    String jsonData;
    public DataAnalysisTool(String jsonData) {
    this.jsonData = jsonData;
    }
    void analyzeData() {
    System.out.println("Analyzed data");
    }
    }
    public class Client {
    public void processData(DataAnalysisTool obj) {
    obj.analyzeData();
    }
    }
    public class Adapter extends DataAnalysisTool {
    XmlData xmlData;
    public Adapter(XmlData xmlData) {
    super("");
    this.xmlData = xmlData;
    }
    @Override
    void analyzeData() {
    String json = convertXmlToJson(xmlData.getXmlData());
    System.out.println("Converting xmlData to JSON format: " + json);
    super.analyzeData();
    }
    private String convertXmlToJson(String xmlData) {
    JSONObject jsonObject = XML.toJSONObject(xmlData);
    return jsonObject.toString();
    }
    }
    public class AdapterPattern {
    public static void main(String[] args) {
    XmlData xmlData = new XmlData("sample XmlData");
    DataAnalysisTool obj = new Adapter(xmlData);
    Client client = new Client();
    client.processData(obj);
    }
    }