-
Notifications
You must be signed in to change notification settings - Fork 1.7k
JavaScript: Restructure implementation of DataFlow::SourceNode
.
#727
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
Conversation
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.
Implementation LGTM.
The improvements seem impressive. Well done.
Are you sure that the improvements aren't due to the change I have flagged as unrelated to the purpose of this PR?
For the record: the introduction of yet another style/naming scheme for working around the quirks of abstract classes is a bit unfortunate. We now have:
InvokeNode
/InvokeNodeDef
ClientRequest
/CustomClientRequest
SourceNode
/SourceNode::Range
- probably more
I agree. Which of the other ones would you like me to switch to? |
I like this change a lot. I also like the Long ago I started a write-up on a canonical naming scheme here but I gave up on rolling it out after the miserable performance I saw in the string concatenation library. |
I also prefer the |
It now uses a facade pattern similar to `InvokeNode`: the range of the class is defined by an abstract class `DataFlow::SourceNode::Range`, while the actual behaviour is defined by the (no longer abstract) `SourceNode` class itself. Clients that want to add new source nodes need to extend `DataFlow::SourceNode::Range`, those that want to refine the behaviour of existing source nodes should extend `DataFlow::SourceNode` itself. While this is technically a breaking API change, I think separating the two aspects in this way is cleaner and makes it easier to use, and improves performance as well.
ef1d08d
to
de42975
Compare
I've rebased to resolve conflicts with the autoformatting PR. Two further minor API-related questions are perhaps worth discussing:
|
I think we should keep the API as is:
|
It now uses a facade pattern similar to
InvokeNode
: the range of the class is defined by an abstract classDataFlow::SourceNode::Range
, while the actual behaviour is defined by the (no longer abstract)SourceNode
class itself.Clients that want to add new source nodes need to extend
DataFlow::SourceNode::Range
, those that want to refine the behaviour of existing source nodes should extendDataFlow::SourceNode
itself.While this is technically a breaking API change, I think separating the two aspects in this way is cleaner and makes it easier to use, and improves performance (internal link) as well.