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

Minimize passing around of ProxyGenerationOptions #529

Merged
merged 2 commits into from
Jul 3, 2020

Conversation

stakx
Copy link
Member

@stakx stakx commented Jul 2, 2020

While doing some prototyping for #517, I noticed that ProxyGenerationOptions instances get passed around a lot needlessly. This refactoring PR gets rid of all excess options parameters that I could identify, and changes some remaining usages to favour constructor injection.

One caveat: Some of these removals may only be temporary. DynamicProxy weaves a web of fairly tightly coupled objects during proxy type generation (generators, collectors, contributors, emitters, etc.). If you need options somewhere, chances are that you'll have to pass them through a whole lot of other objects first. Yet, removing the excess now may be a good thing as it will confront us with that problem all the more in the future, and that may lead us to consider alternative solutions—e.g. refactoring towards loose coupling, simplifying the internal object graphs, making options available through an ambient context, etc.

Copy link
Member

@jonorossi jonorossi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. DP definitely has a spiderweb of an object graph during generation.

@jonorossi jonorossi merged commit a7454e5 into castleproject:master Jul 3, 2020
@jonorossi jonorossi added this to the v5.0.0 milestone Jul 3, 2020
@stakx stakx deleted the proxygenerationoptions branch July 3, 2020 05:29
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