jdanyow / blog-comments

Repo containing comments on my blog
https://danyow.net
MIT License
3 stars 0 forks source link

inversion-of-control-with-aurelia-part-2/ #8

Open utterances-bot opened 7 years ago

utterances-bot commented 7 years ago

Inversion of Control with Aurelia - Part 2

https://www.danyow.net/inversion-of-control-with-aurelia-part-2/

sboyd commented 7 years ago

Mr. Danyow!

I hope you are doing well sir. I've got a question that is somewhat DI related. I'm using Aurelia for an app that I'm creating. I'm in the early stages, but I've already got a few services that I've written/in the process of writing.

I'm already finding that in many of the classes I end up doing what feels quite repetitive. I find that I have to import n services which I then have to add to the @inject decorator, pass it in the constructor then create a local variable which gets assigned to the value passed into the constructor.

I'm thinking about doing this instead and I'd like to see what your thoughts are. I want to instead create one service, almost like a service locate. This one service will then import all my other services, pass them through the constructor, and have instance variables for them. By doing this I then only have to import this one service to access functionality of any of my services.

Hopefully that makes sense.

I wanted to know what your thoughts were specifically around performance and just the idea in general.

Thanks so much in advance. --Steve Boyd

philippejer commented 7 years ago

Very helpful article, thanks!

Two small remarks: