Difference - What Is Dependency Injection (DI) & Inversion Of Control (IOC) | Spring Tutorial

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

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

  • @chandankumar-vm2yc
    @chandankumar-vm2yc 4 หลายเดือนก่อน +1

    Difference B/w Inversion of Control (IoC) and Dependency Injection
    Imagine you're baking a cake, and you need ingredients like flour, sugar, and eggs.
    Inversion of Control (IoC):
    IoC is like having a recipe book that tells you when to add each ingredient and how to mix them together.
    Instead of you deciding when to add flour, sugar, and eggs, the recipe book (or the Spring Framework, in our analogy) takes control and tells you when to add them.
    In Spring, IoC means that the framework takes control of managing the flow of your application. It decides when to create objects, how to wire them together, and when to destroy them.
    Dependency Injection (DI):
    DI is like having someone else provide you with the ingredients you need to bake the cake.
    Instead of you going to the store to buy flour, sugar, and eggs, someone else (like a friend or family member) brings them to you.
    In Spring, DI means that instead of your class creating its own dependencies (like other classes or objects), Spring provides those dependencies to your class from the outside.
    This makes your code more flexible and easier to test because your class doesn't need to know how to create its dependencies; it just uses them.
    In summary:
    IoC is about control flow. It's like following a recipe that dictates the order of operations.
    DI is about providing dependencies. It's like having someone else supply you with the ingredients you need.

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

      Good explanation

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

    So, in a nut shell , can we say IOC is the theory and DI is the practical implementation and is one of the methods of practically implementing IOC?

    • @TechTalkDebu
      @TechTalkDebu  4 ปีที่แล้ว

      Yes... Somewhat you can say .... Actually DI is the subset of IOC
      .....

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

    well explained sir

  • @mohammadikram687
    @mohammadikram687 4 ปีที่แล้ว

    You are really very clear at explaining the concepts. Hands off to you sir for creating such Outstanding videos.
    Cant thank you enough in anyway.

    • @TechTalkDebu
      @TechTalkDebu  4 ปีที่แล้ว

      Thank you @happy learning

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

      dont know if you guys gives a damn but if you are bored like me atm then you can stream pretty much all of the new movies and series on Instaflixxer. Have been watching with my gf during the lockdown xD

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

      @Jett Alfonso yea, been using Instaflixxer for since november myself :)

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

    very good explanation.

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

    Good good good..!!

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

      Thank you for the feedback

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

    Thank you

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

      Welcome 🤗