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

Let's get rid of static field based singletons #17

Open
hurelhuyag opened this issue Mar 26, 2021 · 2 comments · May be fixed by #18
Open

Let's get rid of static field based singletons #17

hurelhuyag opened this issue Mar 26, 2021 · 2 comments · May be fixed by #18
Assignees

Comments

@hurelhuyag
Copy link
Contributor

There is static field based singletons at template files. Those singletons making hard to write tests. In my view, We should get rid of those static fields. Generally it's bad design choice.

I have found some of those:
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/JournalProvider.ftl#L26
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/ProjectionDispatcherProvider.ftl#L22
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/StateStoreProvider.ftl#L34

Event this. I don't see any particular reason to declare static field here.
https://github.com/vlingo/vlingo-xoom/blob/master/src/main/resources/codegen/java/DefaultBootstrap.ftl#L20

@VaughnVernon
Copy link
Contributor

See also this section of code where the Bootstrap must now pass constructor parameters rather than the components being started relying on static objects:

https://github.com/vlingo/vlingo-examples/blob/8f8dc78300b220ba66f7738ce2b89829f331a3d1/vlingo-petclinic/src/main/java/io/vlingo/developers/petclinic/infrastructure/Bootstrap.java#L36

@jakzal jakzal linked a pull request Mar 30, 2021 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants