We just picked up Aurelia. First off, it's great. I love using it so far. It seems to be very modular, which I like. But I got to thinking about WHY they use DI. What's the advantage of using DI? I know it seems to make singleton use easier, but is there any other reason?
From what I understand (and I could be wrong), instead of doing this:
myObj = new myObj();
you do this:
@autoInject
export class myClass {
constructor(myObj) {
this.variable = myObj;
}
}
So, I can't really seem to find an advantage to why people use DI in general. Are there any other reasons that I don't know about?