becketqin commented on pull request #13512:
URL: https://github.com/apache/flink/pull/13512#issuecomment-701705339
@StephanEwen Personally speaking, I think usually people either put both API
and implementation in the same package or completely separate them. The weird
part here is that we have an explicit `api` package containing concrete
implementation. Should we at least take that out of the `org.apache.flink.api`
package, maybe to `org.apache.flink.util.source` in `flink-core`?
Regarding "deep integrate", I feel that this is double-edged and needs to be
considered case by case. I was actually wondering why a
`StreamExecutionEnvironment` also creates sources while it is supposed to take
sources to generate `DataStream`. I feel
`env.addSource(ConnectorUtils.fromCollection())` is equally convenient, where
`ConnectorUtils` looks like something below
```
ConnectorUtils {
NumSequenceSource generateSequence(long from, long to);
<T> CollectionSource<T> fromCollection(Collection<T> collections);
BlackHoleSink blackHoleSink();
PrintingSink printSink();
...
}
```
It follows the general design principle of one class only does one thing,
without overlapping in responsibilities. `StreamExecutionEnv#addSource()` is
the only entrance of registering sources to create new `DataStreams`.
`ConnectorUtils` is the only entrance of getting builtin connectors.
Conceptually, I feel this is easier for users to follow than having `deep
integrate` in separate classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]