[DISCUSS] how choose Scala and Java

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[DISCUSS] how choose Scala and Java

Jinkui Shi
Scala and Java mixed in the module. Some Flink API indeed make someone confused.
What is rule about  the current Scala and Java API at the first implement time?


Thanks
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] how choose Scala and Java

Till Rohrmann
I think you're referring to the implementation of some of Flink's modules,
right?

If that is the case, then the rule of thumb is that we want to use Java for
the low level runtime implementations. For the API implementations it is a
case to case decision. The Scala API, for example is of course implemented
in Scala. For other APIs we tend to use Scala only if it gives a clear
advantage over a Java implementation.

If your question is more like which Flink API to use (either Java or Scala
API), then it's completely up to you and your preferences.

Cheers,
Till

On Wed, Sep 7, 2016 at 8:21 AM, 时某人 <[hidden email]> wrote:

> Scala and Java mixed in the module. Some Flink API indeed make someone
> confused.
> What is rule about  the current Scala and Java API at the first implement
> time?
>
>
> Thanks
Reply | Threaded
Open this post in threaded view
|

Re:Re: [DISCUSS] how choose Scala and Java

Jinkui Shi


Hi, Till, Thanks for your clear reply.


In fact the API of Java and Scala are not coordinating. User are easy confused by the Same class name of Java/Scala API such as `StreamExecutionEnvironment`.
Since Scala can do almost what Java can, Why not use Scala only? Kafka's API looks good. https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/javaapi/consumer/SimpleConsumer.scala
There is a little hard to maintain the Java and Scala API at the same time. Two source packages mean the separated implements each other.
Can we re-consider such base design?

At 2016-09-07 15:26:55, "Till Rohrmann" <[hidden email]> wrote:

>I think you're referring to the implementation of some of Flink's modules,
>right?
>
>If that is the case, then the rule of thumb is that we want to use Java for
>the low level runtime implementations. For the API implementations it is a
>case to case decision. The Scala API, for example is of course implemented
>in Scala. For other APIs we tend to use Scala only if it gives a clear
>advantage over a Java implementation.
>
>If your question is more like which Flink API to use (either Java or Scala
>API), then it's completely up to you and your preferences.
>
>Cheers,
>Till
>
>On Wed, Sep 7, 2016 at 8:21 AM, 时某人 <[hidden email]> wrote:
>
>> Scala and Java mixed in the module. Some Flink API indeed make someone
>> confused.
>> What is rule about  the current Scala and Java API at the first implement
>> time?
>>
>>
>> Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Re: [DISCUSS] how choose Scala and Java

Fabian Hueske-2
The Java and Scala APIs are organized in different Maven modules and the
Scala APIs are based on the respective Java API.
The benefit of this design is to keep Scala dependencies out of the Java
APIs which is requested by many users.

The Java and Scala counterparts of the DataSet and DataStream APIs are
mostly similar, but differ in some details.
For instance, the Scala APIs support Scala Lambda functions and Scala
Tuples and case classes which are not available in Java.

Last but probably most importantly, the Flink community committed itself to
API backward compatibility for all 1.x releases.
Any major API changes could only be done in a 2.x release.

Best, Fabian

2016-09-08 2:54 GMT+02:00 时某人 <[hidden email]>:

>
>
> Hi, Till, Thanks for your clear reply.
>
>
> In fact the API of Java and Scala are not coordinating. User are easy
> confused by the Same class name of Java/Scala API such as
> `StreamExecutionEnvironment`.
> Since Scala can do almost what Java can, Why not use Scala only? Kafka's
> API looks good. https://github.com/apache/kafka/blob/trunk/core/src/
> main/scala/kafka/javaapi/consumer/SimpleConsumer.scala
> There is a little hard to maintain the Java and Scala API at the same
> time. Two source packages mean the separated implements each other.
> Can we re-consider such base design?
>
> At 2016-09-07 15:26:55, "Till Rohrmann" <[hidden email]> wrote:
> >I think you're referring to the implementation of some of Flink's modules,
> >right?
> >
> >If that is the case, then the rule of thumb is that we want to use Java
> for
> >the low level runtime implementations. For the API implementations it is a
> >case to case decision. The Scala API, for example is of course implemented
> >in Scala. For other APIs we tend to use Scala only if it gives a clear
> >advantage over a Java implementation.
> >
> >If your question is more like which Flink API to use (either Java or Scala
> >API), then it's completely up to you and your preferences.
> >
> >Cheers,
> >Till
> >
> >On Wed, Sep 7, 2016 at 8:21 AM, 时某人 <[hidden email]> wrote:
> >
> >> Scala and Java mixed in the module. Some Flink API indeed make someone
> >> confused.
> >> What is rule about  the current Scala and Java API at the first
> implement
> >> time?
> >>
> >>
> >> Thanks
>