-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Expose Executer via factory class #194
base: 1.x
Are you sure you want to change the base?
Conversation
…n classes and more flexible for owner use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skydiablo Thank you very much for looking into this and filing this PR!
I can definitely see some room for improvement for the ResolverInterface
, but my biggest concern here is that adding a new method to an interfaces is inherently a BC break, as it will break all existing implementors of this interface.
We've had a related discussion in #159 (and others), so I wonder how much is really gained by having this as part of the ResolverInterface
instead of using the existing ExecutorInterface
?
(I've added minor remarks below for completeness, but my main concern at the moment would be the BC break mentioned above.)
my motivation is to benefit from the existing Resolver-Factory and also have access to the underlying executor, in detail to the |
@skydiablo Very true, completely agree that this is needlessly complicated. Perhaps we can simplify this by simply exposing the |
@clue just expose an function like |
…the given classes and more flexible for owner use." This reverts commit 8e75be0.
resolveQuery
function
Sounds about right, but just an idea at this point and we'd have to take a look at this more in-depth.
Extending implies an "is a" relationship, not sure "ResolverFactory is a ExecutorFactory" is reasonable. Composition over inheritance? Not sure a dedicated |
divide the two section should the best case and the last change does not have any BC breaks. in case of DI, nobody say you have to use a factory-class, it will just create for you the "best" case of composition. |
src/Query/ExecutorFactory.php
Outdated
use React\EventLoop\Loop; | ||
use React\EventLoop\LoopInterface; | ||
|
||
class ExecutorFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pretty much creates what most end users need to use this component. IMHO using Factory
as name tells enough, and since this object holds no state, we can make all methods static.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind this comment's part on naming, missed that it is in the Query directory. But we can still make all methods static IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, yes it is possible.... @clue ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion here, but not sure I quite like the idea of going more into factory land. I understand it's not optimal, but perhaps adding a new method to the existing factory class helps reduce the API surface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in respect to the upcoming DI/DX in react, a more granular distribution of classes give the best opportunity to combine it in more fancy ways and a test-case can be more precisely. so we should it keep in two classes. the static way can be interest but not really needed, i would it leave as it is ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Been thinking about this over the weekend, and part of the issue of creating another factory is that we'd start putting them everywhere. And you have to start creating aliases for them if you use more than one. Not hard opinions here either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as long as the reactPHP libs does not depend and implement an DI/DX container, a factory is a good alternate. later we can refactor to DI and can exchange or run in parallel mode.
push :P |
this allows to extend the give classes and more flexible for own use.