Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some of the things to watch for (pitfalls) while using IOC container?

What are some of the things to watch for (pitfalls) while using IOC container?

like image 451
StackUnderflow Avatar asked Dec 02 '25 22:12

StackUnderflow


1 Answers

Trying not to fall too much for a Service Locator pattern, where some static wrapper to your IoC container provides you with instances of type xyz. While you may need it at times, ensuring that you do inject your dependencies to your consuming type will keep your code a lot cleaner and make the container much less intrusive.

like image 91
flq Avatar answered Dec 05 '25 13:12

flq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!