Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable eager services by default in ContainerInstance #17

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

freshgum-bubbles
Copy link
Owner

@freshgum-bubbles freshgum-bubbles commented Jun 24, 2023

Eager loading is generally discouraged, as it makes testing harder and makes the application more confusing to work with. For instance, see:
typestack/typedi#380.

Consider an example of a DatabaseService with eager loading enabled. Once imported, database connections and more will
immediately start taking place.

In many cases, this will be unexpected and will
ultimately be an unwanted side effect.

Therefore, we place the eager loading functionality behind a toggleable option,
which must be enabled prior to any eager loading
strategies taking place.

@freshgum-bubbles freshgum-bubbles force-pushed the feature/prevent-side-effects branch 2 times, most recently from 76d0a29 to a8bae44 Compare June 25, 2023 00:01
Eager services are harder to test, and
make application behaviour more brittle.
As a result, I do personally discourage
using them.
Therefore, by default they are now disabled.

This will need more testing.

Some further remarks below:
Eager loading is generally discouraged, as it makes testing harder
and makes the application more confusing to work with.
For instance, see:
  [typestack/typedi#380](typestack/typedi#380).

Consider an example of a DatabaseService with eager loading enabled.
Once imported, database connections and more will
immediately start taking place.

In many cases, this will be unexpected and will
ultimately be an unwanted side effect.

Therefore, we place the eager loading functionality
behind a toggleable option,
which must be enabled prior to any eager loading
strategies taking place.
@freshgum-bubbles freshgum-bubbles added the enhancement New feature or request label Jun 25, 2023
@freshgum-bubbles freshgum-bubbles changed the title feat(ContainerInstance): disable eager services by default Disable eager services by default in ContainerInstance Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant