osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CALCITE-2458 Use of Kotlin for unit tests


I have been using Kotlin for a few months and really like it. It
doesn't stray too far from Java except for a few places chosen to give
maximum benefit. I think that Scala went too far, and produced a
language in which you can easily write dense, obscure programs; Kotlin
has learned from Scala's mistakes.

But I set a high bar to adopting a new framework or language. Once
code is written, it is in the project forever, and needs to be
maintained. A large majority of contributors need to be comfortable
reading, editing, and running such code.

I have regrets about allowing Mockito into Calcite (it is only used in
the Druid adapter) and JMockit into SQLLine. I am not familiar with
these frameworks, don't have time to learn, and consequently cannot
modify the tests. (I can't even figure out how to even run the
JMockit-based test in SQLLine.)

So, I'd like to hear from Calcite contributors - would you be prepared
to take the time to learn Kotlin? (If you know what is a companion
object and a receiver, I'd say you're an advanced Kotlin user.)
On Mon, Sep 17, 2018 at 5:50 PM Laurent Goujon <laurent@xxxxxxxxxx> wrote:
>
> -0 I kind of share Michael's concern that it might be a barrier, and the
> provided patch doesn't really showcase the announced benefits, and I would
> be fairly careful when introducing a new language into the project (the
> patch for example allows compiling production code with kotlin notably). Is
> there a good test class which is fairly complex in Java but could be
> written nicely in Kotlin? What about IDE support (editor, debugger, ...)?
>
> No direct exposure to Kotlin, but I did some good chunk of Scala where the
> same kind of benefits were advertised, but I remember some of my colleagues
> new to the language struggling with contribution (although you could read
> the code as an english sentence...), and so just being careful.
>
> On Mon, Sep 17, 2018 at 12:47 PM Michael Mior <mmior@xxxxxxxxxx> wrote:
>
> > +0.5 I haven't used Kotlin but I've had enough exposure that I'm very
> > interested in the idea. The main reason for the lack of a +1 is a concern
> > that it may prove a barrier to new contributors but if others are for it,
> > it's the excuse I've been looking for to finally write some Kotlin. I think
> > test code is just the place to introduce something like this. Anything that
> > makes test code less verbose is a good way of encouraging more tests to be
> > written :)
> >
> > --
> > Michael Mior
> > mmior@xxxxxxxxxx
> >
> >
> > Le lun. 17 sept. 2018 à 15:21, Vladimir Sitnikov <
> > sitnikov.vladimir@xxxxxxxxx> a écrit :
> >
> > > Hi,
> > >
> > > I think it time for us to enable use of Kotlin in unit tests.
> > > There are lots of language features (e.g. name parameters, data classes,
> > > multiline strings, infix functions, nullability, smart casts, etc) that
> > > would make code simpler to read and write.
> > >
> > > Note: the change is related to use of Kotlin in test-code only.
> > > Kotlin use for production classes might require a bit more of thought
> > (e.g.
> > > the set of dependencies, etc), so let's settle on Kotlin for tests first.
> > >
> > > More details can be found in:
> > > https://issues.apache.org/jira/browse/CALCITE-2458  (created Aug 8)
> > > PR: https://github.com/apache/calcite/pull/786 (created Aug 9)
> > >
> > > If no-one objects within a week, I'll assume lazy consensus and commit
> > it.
> > >
> > > It might be nice to gather a bit more feedback on the change though. What
> > > do you think of the change?
> > >
> > > If you struggle what to say, you might find the below options useful:
> > >
> > > [ ] ++1: 'Wow! I like this! Let's do it!'
> > > [ ] +1: 'Let's do it!'
> > > [ ] +0.9: 'This is a cool idea and i like it'
> > >
> > > Vladimir
> > >
> >