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

Introduce actor factories #1744

Merged
merged 4 commits into from
Mar 31, 2021
Merged

Introduce actor factories #1744

merged 4 commits into from
Mar 31, 2021

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Mar 26, 2021

We'd like to provide an abstraction for child actors creation, otherwise our actors become too tightly coupled and hard to test in isolation. But we don't want to move too much business logic outside of the actor (for instance the choice of child supervision strategy).

I'm going with a simple ad-hoc factory pattern in this PR, which removes unnecessary fields in actor constructors and allows more flexibility in tests. I must say I'm not entirely satisfied, but can't find a simple alternative (it's important to have a simple solution here, I don't want to make it harder for readers of the code).

If you have a better naming for the concrete Factory classes, let me know!

This removes unnecessary fields and allows more flexibility in tests.
@t-bast t-bast marked this pull request as ready for review March 29, 2021 07:40
@pm47
Copy link
Member

pm47 commented Mar 29, 2021

I don't really like factories in general, but I don't know a better way of solving your problem, and I have to say it looks pretty clean.

Regarding names, I would have gone with SimplePeerFactory/SimpleChannelFactory.

@t-bast
Copy link
Member Author

t-bast commented Mar 30, 2021

Regarding names, I would have gone with SimplePeerFactory/SimpleChannelFactory.

Done in 52af730

@t-bast t-bast merged commit c6a76af into master Mar 31, 2021
@t-bast t-bast deleted the actor-factories branch March 31, 2021 06:58
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 this pull request may close these issues.

2 participants