Dependency Injection | Comparison between DI, IoC and DIP | Dependency Injection Unit Testing.

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024
  • In this video, we will learn the basics of Dependency Injection.
    With the help of the same example, we will learn Inversion of control, Dependency Inversion Principle, and Dependency Injection.
    We will also answer the very basic but most confusing question which developers have
    that is
    How Dependency Injection help in Unit Testing?
    We will also explore
    How can web config be your best example in an interview when explaining IoC?
    Why should we use DI when we already have DIP?
    #PROConcepts #AmitRawat #ProgrammingConcepts #PROConceptsByAmit #ProgrammingConceptsByAmit #ProgrammingConceptsByAmitSinghRawat #ProConceptsByAmitSinghRawat
    #DIP Vs IoC Vs DI

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

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

    Perfect thanks it was too helpful for me, your way is too simple for the IOC & DI. Again thanks a lot

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

    This is by far the best video in this topic.

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

      Glad to know you think this way. Thanks for your positive feedback 😊

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

    Nicely explained, thanks for making this video... looking forward for design patterns videos.

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

    Excellent video

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

      Thanks Pranesh, for your positive feedback 😊

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

    Good comparison ❤

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

      Glad you like our content. Thank you for visiting our channel.

  • @exe.m1dn1ght
    @exe.m1dn1ght ปีที่แล้ว +1

    2:50 what do you mean when you say if there is some change in class B then it's gonna impact class A ? If i make a change in class B then it's normal for class A to feel that change no ? otherwise why i make the difference in class B if i don't want class A to be affected in some way ? Or the word impact means changing code in class A ? Do you mean if there is some change in class B , then you will need to change code in class A ? Because the word impact can have many interpretations , which one is true ?

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

      Hi @exe.m1dnight,
      Your last statement is correct. As developers, we are responsible for reducing dependency as much as possible. If there is a change in class B, then we need to prepare our class A in such a way that either no or minimal modification is required in class A.

    • @exe.m1dn1ght
      @exe.m1dn1ght ปีที่แล้ว

      @@ProConcepts how can class B change and affect class A? Can you give me examples?

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

      I already covered an example in this video via LogToText and LotToSQLDB Class.
      Here in this case, if you add a parameter in Class B constructor you have to change your class A and to all similar classes that are referencing Class B. But if you are using DIP or DI, there will be only one place in your project where you take the responsibility for object creation. In that case, you only need to make modifications only in one class, not in all the classes that are referencing Class B.
      What if you don't want to use Class B altogether? There is a different team or Vendor who created class C for you which is more efficient. Then in all referenced classes, you have to create an object of Class C.

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

    Amit, can you upload Design patterns??

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

      Hi SENATHIPATHI,
      Glad to know you want to see more videos from this channel. I will definitely try to create videos on this topic as well.
      As I am not a professional TH-camr and only creating videos in my free time, it might take some time 🙂

    • @senakr
      @senakr 3 ปีที่แล้ว

      @@ProConcepts Really you look like professional youtuber... With in a short term you got very good viewer.... You will get very good returns... I will support always from Bangalore 👍

  • @niteshchauhan7732
    @niteshchauhan7732 3 ปีที่แล้ว

    Sir plz config file did not get plz

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

      Hi Nitesh,
      With IOC, the general idea is to give responsibility to someone who can handle it better than the current implementation.
      When we create a class library, the main purpose is either reusability or separation of concern. If I hardcode connection string in my class library (.dll) project, it will be tightly coupled with my DLL project. Which we certainly don't want. We want whosoever using my DLL can set their own connection string (or any other properties) as per their needs.
      So, If you are using DLL within your web project you can consider yourself one of the clients of that DLL. And you can define connection string in your web.config file, instead of the DLL owner hardcode connection string in their project.

    • @niteshchauhan7732
      @niteshchauhan7732 3 ปีที่แล้ว

      @@ProConcepts Thanks sir..