IQ 25: What is Dependency Injection?

preview_player
Показать описание
This video explains the concept of dependency injection
Рекомендации по теме
Комментарии
Автор

Thanks for the example. Great, comprehensible explanation.

davidlavanchy
Автор

Service is concrete and should be abstract (Interface) for this example to be 100% loosely coupled. The whole idea DI is to have a loosely coupled design.

lumenr
Автор

Very well done, not too simple, and not overly complex in the explanation.

grantmurphy
Автор

Far from mediocre, this video is cool.

jonathanelkins
Автор

Amazing explanation. Very clear and I finally understand it. Your video is better than the other ones I've watched.

rayc
Автор

Thanks
Finally I understood what is dependency injection

Musa.Almatri
Автор

your sound looks very good, and so clear, the way you explained/described the idea in developing it was also nice, but you missed the full definition of the term at the first place, you should be saying, dependencies are ...., then you go to dig into the subject.thanks anyway.

bouhannacheabdallah
Автор

8:20 You don't actually need Service object in the Customer class. In fact, Your class is still somewhat dependent on the Service class since the constructor expects it as an argument to instantiate the Customer. A better approach would be to directly pass the service object as an argument to the method, e.g. viewCustService(Service s), and use it inside the method. This way, your class is not dependent on it, and solely viewCustService will expect it as an argument not your class. So even if there is a problem with the Service class, your Customer class will still instantiate perfectly but you may encounter an issue only when the viewCustService is called.

where-is-my-mind.
Автор

So basically instead of hardcoding object creation in classes you pass it to constructor as argument?

a.yashwanth
Автор

Love the page. Forgive me if I mistake you and I mean nothing by it but you sound like a black man and I love supporting and linking up with all coders but especially black coders ✊🏿✊🏾✊🏽✌🏾🙌🏾👍🏾

Followed, I'll spread your videos!

andream
Автор

This was the easiest and clearest video illustrating this concept, thanq

ayasalama
Автор

Very good explanation...clear and understandable

jkmalify
Автор

Thank you for explanation. It is easy to understand.

thanhdong
Автор

very good stuff. much more understanding of this concept. Heard it tossed around alot and great :)

younglife
Автор

simple explanation... thank you so much!

taureau
Автор

Great! Thanks! Short and VERY helpfull !

btw you sound little like Samuel L. Jackson :D

Staszek
Автор

Nice and simple explanation of DI. However a few remarks in terms of java best practices: "name" field should be defined "private" in Service class (encapsulation), and there is no use to return string from viewCustService method in your example (redundant) since you already print the service name inside the method. I believe explanation of complex issues should still follow the best/basic practices. Regards.

mehmetalikarabulut
Автор

So in nutshell, it's passing an obj1 as a constructor argument to obj2, where object1 is an object's field of obj2.

UmpikLumpik
Автор

Dependency Injection Lay Man Terms. A charging adapter with usb port has inverse dependency with pendrive. Direct dependency means only a pendrive can be plugged into the charging adapter. Usb (universal serial bus technology is called the interface) . The company that made the adapter exposed an interface. Pendrive making company injected the dependency which is the pendrive device. Since the charging adapter has reversed or inversed the dependency you can now plugin a mouse or a keyboard or anything to this adapter. Thats it

rahulmathew
Автор

Thank you. I've had so much trouble with this concept. I believe I understand it now.

v.