We built Roll for Android ( http://tryroll.com ) in Kotlin -- we currently have ~17k lines and have been working on it since this Spring. We wanted to iterate on a lot of the software structure we came up with for our Swift iOS app, and for a bunch of pieces we needed a powerful type system. So rather than just stick with Java -- as others have said, it's way too verbose, we started looking at alternatives. We wanted…
Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
191–200 of 203 posts
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#192At JetBrains we're using Kotlin on a few projects now. Some of them are internal, some are public facing. In addition, some of our existing (and new) products are now using Kotlin. IntelliJ IDEA 15 will be shipping with Kotlin plugin enabled by default. Kotlin is a tool we created out of need. We're using it and we're relying on it, so I'd say it's got a very good long term viability.
What was the need that Kotlin arose out of?
http://blog.jetbrains.com/kotlin/2011/08/why-jetbrains-needs...
The nice thing about that post is that they (Jetbrains) are pretty honest about the whole things e.g.
"First and foremost, it’s about our own productivity."
"The next thing is also fairly straightforward: we expect Kotlin to drive the sales of IntelliJ IDEA. "
"The final point is less obvious but still important: new programming languages is a topic that many people really enjoy talking about, and the first days that have passed since we’ve unveiled Kotlin prove that."
"And we’d like to reiterate that our work on Kotlin does not in any way affect our investment into other development tools, and in particular the Scala plugin. If you’re already happy with Scala and have no need for another new language, we’ll continue to do our best providing you with first-class Scala development tooling."
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#193Earlier quoted context omitted.
1. None of those features (except sealed ADTs, which really aren't necessary) is missing from Kotlin. The set of Scala features Spark is using is pretty much identical to Kotlin. 2. I don't see how IBM's investment has anything to do with Scala, though. Spark is a great product, and deserves an investment even if it were written in BASIC. 3. Even if Spark did rely on Scala features that aren't in Kotlin (it doesn't),…
Good points, as always. > None of those features (except sealed ADTs, which really aren't necessary) is missing from Kotlin. The set of Scala features Spark is using is pretty much identical to Kotlin. I didn't mention implicit conversions, but that's one area where Scala has taken the high risk high reward path. If you look a bit further down on the linked Spark page you'll see the conversions defined [1]. I'd say S…
We C++ veterans know that implicit conversions are one of the worst ideas to put in a language. They start simple enough and then they get clever, which is where trouble starts.
> i.e. if you know what you're doing have at it; otherwise keep to a strict subset
There are few things about programming language design we know, because getting empirical data is so hard. One of the few things we do know (from C++ in the nineties, of course) is that this kind of design doesn't work. The average codebase lifespan is about a decade, during which time people move around and team leads change. Everyone has their own discipline, and by year 5 (usually earlier), the codebase is unmaintainable.
Of course, now that C++ has been re-branded and re-purposed as a specialized language for close-to-hardware software, and is used by specialists, it is doing quite well. I certainly wouldn't mind Scala marketing itself -- like C++ and Haskell do -- as a language for specialists (although even specialists would be better off opting for the excellent OCaml implementation on the JVM, or even Frege if Haskell is your cup of tea).
There is absolutely no reason to be as multi-paradigm as Scala is on the most polyglot platform around, which brings me to:
> that power... is what draws dsl authors to Scala.
One of the great things about the JVM is its relatively easy inter-language interop. I would use a meta-language made for DSLs (like Clojure, MPS or Xtext) for my DSL, while I'll write the infrastructure in Java/Kotlin. Learning Java and Clojure, or Kotlin and MPS, is easier than learning Scala alone (well enough for DSLs), and the results are cleaner, produce more maintainable code and better error messages (well, I wouldn't say Clojure excels at error messages, but at least the DSL writer has full control over them, and can make them quite good with an extra bit of effort).
Also, I'd like to see what those DSL codebases look like after five years of heavy usage (not to mention the error messages Scala spits out, which are completely unparsable to anyone who does not understand how the DSL is constructed).
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#194Earlier quoted context omitted.
Good points, as always. > None of those features (except sealed ADTs, which really aren't necessary) is missing from Kotlin. The set of Scala features Spark is using is pretty much identical to Kotlin. I didn't mention implicit conversions, but that's one area where Scala has taken the high risk high reward path. If you look a bit further down on the linked Spark page you'll see the conversions defined [1]. I'd say S…
> I didn't mention implicit conversions, but that's one area where Scala has taken the high risk high reward path. We C++ veterans know that implicit conversions are one of the worst ideas to put in a language. They start simple enough and then they get clever, which is where trouble starts. > i.e. if you know what you're doing have at it; otherwise keep to a strict subset There are few things about programming langu…
Too late to yank them now, can be disastrous in the wrong (read: beginner) hands, but they're fantistically useful in the dsl department so...
> The average codebase lifespan is about a decade
maintainability is an issue for the long haul, sure, Scala won't win that battle until it stabilizes, which is at minimum 3 years away when Dotty (Scala 3) comes on the scene.
> I certainly wouldn't mind Scala marketing itself -- like C++ and Haskell do -- as a language for specialists
Typesafe does the marketing, and as a business they'll never sell their technology short, even if what you say is closer to the truth wrt to specialization.
> better off opting for the excellent OCaml implementation on the JVM, or even Frege if Haskell is your cup of tea
no users = no dice; doubt either will grab much mindshare in the near-term. Personally I would love to see SML cherry pick the non-crufty good parts of OCaml (including coming implicit parameters) and have that find a following outside of current tiny academic circle it languishes in.
> Also, I'd like to see what those DSL codebases look like after five years of heavy usage
They probably look a lot different than how they started out as...paraphrasing someone, "you're going to rewrite it [your application] at least 3X" ;-)
Basically the entire Scala ecosystem is a moving target, including the language itself. Enterprise outfits looking for a static dependency graph that will work today and 10 years from now should look at Java as the host language. I doubt Kotlin will be able to deliver the same guarantees, but if it can, watch out Oracle.
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#195Earlier quoted context omitted.
> I didn't mention implicit conversions, but that's one area where Scala has taken the high risk high reward path. We C++ veterans know that implicit conversions are one of the worst ideas to put in a language. They start simple enough and then they get clever, which is where trouble starts. > i.e. if you know what you're doing have at it; otherwise keep to a strict subset There are few things about programming langu…
> We C++ veterans know that implicit conversions are one of the worst ideas to put in a language Too late to yank them now, can be disastrous in the wrong (read: beginner) hands, but they're fantistically useful in the dsl department so... > The average codebase lifespan is about a decade maintainability is an issue for the long haul, sure, Scala won't win that battle until it stabilizes, which is at minimum 3 years…
I don't think that's selling it short. Accurately describing your product only prevents people who aren't really your target -- like me -- from being disappointed and telling the world about it, while it helps attract precisely those people who would be most excited about it.
Also, I think Typesafe realize now that there is not much money to be made in developing and supporting a programming language (ironically, there is some to be made -- though not too much -- supporting specialist languages; see Ada and Matlab). That's why they want to change their name, right?
> no users = no dice; doubt either will grab much mindshare in the near-term.
That's splitting hairs a bit; Scala doesn't exactly have mass appeal either. We're talking about the difference between tiny and small.
> I doubt Kotlin will be able to deliver the same guarantees, but if it can, watch out Oracle.
I know they're trying to. Also, I know Oracle actively encourages alternative JVM languages. Their product is the Java platform, which currently -- to be honest -- is not too far from being the same as Java the language (all alternative JVM languages combined don't amount to 10%, or possibly even 5% of the JVM ecosystem). But they wouldn't mind if that changes. Their research team working on Graal, HotSpot's next-gen JIT, coming to OpenJDK in Java 9, spends as much time on making sure it runs Ruby, R, C, Python, and JavaScript well as it does on making sure it runs Java well. I know Oracle's Java team isn't all too happy about it, but I also know that that's what Oracle wants.
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#196I started an open source Android project in Kotlin ( https://github.com/dodyg ) three years ago so I have witnessed the language evolution from early on. This is what I love about Kotlin: - It is IMHO the best language to develop native application in Android by far. - I was primarily a C# developer (still now) and I could pick up the language in a day. The language is quite small for people that has already known a…
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#197I've played a bit with Kotlin and have a much better knowledge of Scala, so I could be biased. I like Kotlin, it looks like Java should look like. Kotlin is "just" a better language and not a complete new World like Scala. In Scala it feels often wrong to use a Java lib instead of a Scala lib. So, Kotlin is a smooth upgrade for all Java developers. But Scala is much, much more powerful than Kotlin. Just look at Scala…
Traits seem like an odd feature to pick. What are you thinking of, precisely? Kotlin interfaces are basically the same: they can contain method and property impls (same as Java 8). Do Scala traits have some additional feature I am unaware of? I admit to a little bias: I've tried to get into Scala several times, but the bad documentation and often overly complex approach puts me off. A lot of Scala features seem like…
Oracle would probably never have started to experiment with value types and specialized generics, if Scala didn't take the plunge and implemented, tested and shipped it years ago already.
Of course there are restrictions... but the choice was basically either never getting value types and generics, or accepting some restrictions until Scala drags Java into the 1990ies.
It's the same with extension methods. If the only thing you ever knew where extension methods, they would look pretty exciting. But after being aware of the full range of approaches, extension methods are "meh" ... they only implement the least useful part of implicits.
If I had to decide between extension methods and nothing, I'd pick nothing. Extension methods are just not pulling their weight.
Scala does a lot of things in a certain way, because the have > 10 years of experience experimenting with various approaches.
I suggest that you try to understand _why_ Scala does things this way, instead of assuming Scala devs are stupid. It's pretty likely that everything Kotlin does has been considered by Scala developers 5 years ago already–and discarded because better designs were discovered.
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#198Earlier quoted context omitted.
What was the need that Kotlin arose out of?
To summarize, we were looking for a language that could cut down our code base (IntelliJ platform and server side tools are written in Java), be concise but still expressive, toolable, as fast as Java, easy ramp-up time, and very important, interoperable with all the existing code base we had. Given the candidates at the time, it was decided to start Kotlin.
... and when you went to the Scala developers, they said "no, we aren't interested in such improvements at all, even if you implemented them yourself"?
Hard to imagine...
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#199Earlier quoted context omitted.
Clojure devs don't seem to care about performance. Just check how the JVM gets the blame for what is essentially Clojure initialization time. There are some in the community trying to improve the situation, but those are kind of forks like Skummet.
By "performance" I think you specifically mean "startup time." I think there is a big difference between startup time and runtime performance. It is well-known and fully acknowledged by the Clojure community that starting up a Clojure environment and REPL takes a while. But are you also suggesting there is a problem with Clojure runtime performance?
Re: Ask HN: Has anyone here programmed in Kotlin? What do you think about it?
#200For Android development, it is even sweeter, who likes keep using `findViewById()`. Kotlin-Android-Extension does that automagically.
I even write my own HTTP lib for Android entirely in Kotlin. If you like to check it out, here it is (https://github.com/kittinunf/Fuel)