Difference between dependency injection and dependency inversion

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 82

  • @b0606089
    @b0606089 2 หลายเดือนก่อน +2

    watched numerous videos time to time about this, this is the best explanation so far. thanks!

    • @CodeCat15
      @CodeCat15  หลายเดือนก่อน

      Glad it was helpful 😊

  • @akhilgupta6883
    @akhilgupta6883 ปีที่แล้ว +3

    Dependency Inversion is dependency injection using protocols -- Simple and best explanation.
    Thank you Ravi for your cleanest explanation.

    • @CodeCat15
      @CodeCat15  5 หลายเดือนก่อน

      Glad it was helpful

  • @hemantvitthal3732
    @hemantvitthal3732 2 ปีที่แล้ว +1

    Thank you for making video in hindi language. I understand all concept. You doing great jobs.

  • @rajeshpothuraju5281
    @rajeshpothuraju5281 2 ปีที่แล้ว +3

    Ravi, Your explanation is very clean and easy to understand. Anyone can understand the concept from beginners to pro level. Thank you so much.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thank you for your kind words

  • @AnkitGupta-hv2xe
    @AnkitGupta-hv2xe 8 หลายเดือนก่อน +1

    I faced the same question in interview and got confused. Now I know the difference, will shoot the answer to the interviewer now🙂.
    Thanks Ravi Sir.🙌
    Your explanation is always the best among all the iOS Creators.👏

    • @CodeCat15
      @CodeCat15  5 หลายเดือนก่อน

      Next time you’ll surely answer more confidently Ankit. All the best for your interviews and feel free to ask more questions.

  • @mafarunnisap.k5151
    @mafarunnisap.k5151 2 ปีที่แล้ว +1

    Thanks a lot Ravi. Simple, clear and concise..

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      You're most welcome

  • @atulkumar-bb7vi
    @atulkumar-bb7vi ปีที่แล้ว +2

    Very clear explanation but you missed very important fact here that why we need to use dependency injection and not to create the class objects in the class. This is because we can pass different implementations of that dependencies at the runtime. So by using dependency injection, we are binding class signature not the concrete implementation util runtime. Actual implementation can be decided runtime and can be changed with any other implementation without making any changes within all classes which are using that dependency. Thanks!

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว +1

      That’s a good catch Atul and thank you for bringing it up. If my memory serves me right I did explain this in some other video I think it could be the protocol series but yes this is the true power of DI

  • @satyamkumar-mb4sd
    @satyamkumar-mb4sd 2 ปีที่แล้ว +1

    Thank you so much Sir, both keywords differences are now very clear.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Excellent, glad to know the video was helpful

  • @JunaidKhan-ny8tu
    @JunaidKhan-ny8tu 2 ปีที่แล้ว +3

    Thank you Ravi Bhai . We mostly use dependancy Inversion principle when creating viewContoller instance . Before that I was understanding that its dependancy injection

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      ViewController instance using DIP that’s great do share an example on discord if possible thanks 😊

    • @JunaidKhan-ny8tu
      @JunaidKhan-ny8tu 2 ปีที่แล้ว +1

      @@CodeCat15 thanks I will share there

  • @awais.fayyaz
    @awais.fayyaz 2 ปีที่แล้ว +1

    Thank you very much for what you are doing. I very much like the Nice and clear explaination of these concepts.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thank you for your kind words and I am glad the video was helpful. 👍

  • @vishalbhai123
    @vishalbhai123 2 ปีที่แล้ว +1

    Bhaji you are the best. I learn a lot from your videos. I got lot offer letters 😊 just because of you. Thanks a ton.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Kya baat hai congratulations Anirudh 🎉

    • @vishalbhai123
      @vishalbhai123 2 ปีที่แล้ว +1

      I am waiting for combine framework videos. Please create videos on some concepts of combine 😜

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      I have a playlist on combine which should get you started and as a matter of fact today I released a video showcasing all the misleading practices that are spread on the internet for combine and I strongly recommend you to check that out and share with your iOS group so that such bad practices can be avoided in the iOS community
      Video link: th-cam.com/video/fThwWm-Tv7c/w-d-xo.html

  • @abhiram5347
    @abhiram5347 ปีที่แล้ว +1

    Excellent session sir , very neatly explained

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว +1

      Thank you Abhi, I am glad this was helpful, please feel free to ask more questions and do share the video with your iOS group.

  • @AbdulRehman-mk1fz
    @AbdulRehman-mk1fz 2 ปีที่แล้ว +1

    Awesome explanation. Much appreciated ♥

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Glad this was helpful 😊

  • @monikaraut5266
    @monikaraut5266 ปีที่แล้ว +1

    You cleared my doubts
    Thank you so much 👍

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว

      Welcome to the channel Monika, and I am glad this video was helpful.

  • @amarshirke31
    @amarshirke31 2 ปีที่แล้ว +1

    Thank you very much Sir, Finally my doubt got resolved 😊

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Glad it was helpful 👍

  • @umairahmad4368
    @umairahmad4368 2 ปีที่แล้ว +1

    Thanks, Sir for describing it with an exclusive CodeCat15 example :)

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Glad the example was helpful 😊

  • @vinodbhaskar6927
    @vinodbhaskar6927 2 ปีที่แล้ว +2

    Great effort Ravi 🙌🏻

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks Vinod, am glad this was helpful.

  • @TJ-16
    @TJ-16 2 ปีที่แล้ว +1

    Nice video, can we use dependency injection in unit test case while writing api calling test cases?

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Sure we can, when you create the object of the class then you would have to pass the dependency for the functionality to make it work OR you can also use mocks but I don’t recommend mocks if you can hit a API in sandbox environment of yours or maybe dev too

    • @TJ-16
      @TJ-16 2 ปีที่แล้ว

      @@CodeCat15 Ok we have to used actual data instead of mock data for test cases, right ?

  • @umairkhan4982
    @umairkhan4982 2 ปีที่แล้ว +1

    Great Explanation, thanks

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Glad it was helpful 👍

  • @harshilparmar9076
    @harshilparmar9076 2 ปีที่แล้ว +1

    That first line bro 🎯

  • @krishramakrishna9567
    @krishramakrishna9567 6 หลายเดือนก่อน

    Please explain what's problem ic we create a object inside another class

  • @nilanjanmajumder9831
    @nilanjanmajumder9831 ปีที่แล้ว

    explained very nicely ✌

  • @Ankit-ug7ep
    @Ankit-ug7ep 2 ปีที่แล้ว +1

    What is the issue if we make instance of LoginAPI inside LoginViewModel with private keyword?

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      From a clean code perspective you break single responsibility principle,
      the job of a view model is to orchestrate the calls and not have the logic to make those calls
      you may have the code inside the viewModel of URLSession or core data etc but then this gives rise to massive viewModels just like massive view controllers

    • @Ankit-ug7ep
      @Ankit-ug7ep 2 ปีที่แล้ว

      @@CodeCat15 Thanks for quick response...I got the idea...

  • @haroonurrasheed4340
    @haroonurrasheed4340 ปีที่แล้ว +1

    Great job keep it up.

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว

      Thank you Haroon, am glad this was helpful

  • @SurenderSingh-lk1xy
    @SurenderSingh-lk1xy 2 ปีที่แล้ว +1

    Thanks a lot Ravi, great job 👍

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      Glad this was helpful, feel free to ask questions and do share the video with your iOS group

  • @SubhashJaiswar-mu1qj
    @SubhashJaiswar-mu1qj 4 หลายเดือนก่อน

    best example great

  • @subinsuresh3234
    @subinsuresh3234 2 ปีที่แล้ว +1

    Is it breaking Encapsulation?

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      encapsulation is hiding the implementation details abstraction is providing relevant information to the client to get the job done, but sometimes when you provide something that's not required by the client we break abstraction and not encapsulation, the implementation details are always hidden from the caller of the method the caller just knows that on the tap of the button something happens and I get my data or the required function is executed
      Example: On press of the remote control button the channel is changed, you just know that on the tap of the button the channel is changed, what really happens when the button is pressed those semantics are hidden from you or should i say the implementation details are encapsulated from you and you are given an abstracted layer to interact with.
      Does that answer your question? If not please ask more

  • @sanjeevreddy1756
    @sanjeevreddy1756 2 ปีที่แล้ว +1

    thanks for the greate explaination

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Am glad this was helpful Sanjeev

  • @thestreetboy03
    @thestreetboy03 2 ปีที่แล้ว

    Ravi ,plz make a video on swinject for DI

  • @buba7456
    @buba7456 2 ปีที่แล้ว +1

    Thank you Ravi.love it.. Can you please make a video on how to integrate fastlane in our project(with Demo)

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      I have no experience with fastlane but maybe azure, let's see

  • @ranjanmondal1340
    @ranjanmondal1340 2 ปีที่แล้ว +1

    Nice video ❤️ But after watching this video I have a small doubt about what is encapsulation and abstraction ? Now I am getting confuse with this two.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Abstraction is giving relevant information when asked and encapsulation is hiding all the details, I wrote an article on this on medium do check it out and ask questions if you still have them
      medium.com/@codecat15/object-oriented-programming-principles-simplified-22484edf42d7

  • @shaikhrakib3247
    @shaikhrakib3247 2 ปีที่แล้ว +3

    Great video

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Glad you enjoyed it

  • @prataprana2963
    @prataprana2963 2 ปีที่แล้ว +1

    Great video❤️❤️👏🏻

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Glad this was helpful bro 😎

  • @dhavalnena7386
    @dhavalnena7386 ปีที่แล้ว +1

    Excellent!

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว

      Many thanks, glad this was helpful

  • @jaspreetsingh-nh7kn
    @jaspreetsingh-nh7kn ปีที่แล้ว +1

    Awesome👌👌

    • @CodeCat15
      @CodeCat15  ปีที่แล้ว

      Thanks, glad it was helpful

  • @Shade_with_me_7
    @Shade_with_me_7 2 ปีที่แล้ว +1

    Hi Ravi
    Thanks for the making amazing videos to clear out our doubts/concepts
    As given link in description for the invitation of the Discord, I am unable to enter Captcha in input field because in my case it says it is only read only channel
    You can please help me in this case.
    I will be thankful.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Okay I'll check it out, you may want to confirm your phone number with discord before it allows you to enter the details that's a validation I added to avoid bot spamming, if you have already done that then please ping me on discord I'll help you out

  • @waheedafolabi6929
    @waheedafolabi6929 2 ปีที่แล้ว +1

    Thanks 🙏 Ravi

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Always welcome

  • @vaibhavr43
    @vaibhavr43 2 ปีที่แล้ว

    Crystal clear

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Glad it was helpful

  • @deepakkuar1407
    @deepakkuar1407 2 ปีที่แล้ว +1

    nice video bro.

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว

      Thanks, I am glad this was helpful

  • @abhinavmandloi
    @abhinavmandloi 2 ปีที่แล้ว +1

    Hi,
    Your explanation is very clean :) Can you please make a series of videos on Unit test cases??

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      There’s a playlist on test cases do check it out, let me know if that helps
      th-cam.com/play/PLb5R4QC2DtFtDhqnkOsjHElzg_GzJiPTa.html

  • @z_shawgaming_BGMI
    @z_shawgaming_BGMI 2 ปีที่แล้ว +1

    Creative developer's opinion 😂😂😂

    • @CodeCat15
      @CodeCat15  2 ปีที่แล้ว +1

      hahahah that is true, but the private keyword one is a little tricky and it will work if you plan it out but then that's too much effort to maintain so not a robust solution as it has openings for errors