Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It feels like nobody is addressing WHY angular uses DI/IoC.. In something like Java or .NET, you use it to a large extent because it separates code nicely and makes it easier to test.

In JS, one big problems is that you want your code to live in different files, and to do this, you either create your own ghetto object namespaces that hold your classes, or use requirejs.

In the case of Angular, they decided to handle this for you, so they provided IoC/DI as a means to accomplish this. They are merely doing this to make up for things that are missing in javascript as a language.

In their defense, it actually works kind of nice compared to the other two approaches imho.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: