back to article Sick of Java and C++? Google pours a cup o' Kotlin for Android devs

Google on Wednesday said it has made Kotlin a first-class language for Android development, alongside Java and C++. "We did it because Kotlin is a beautiful programing language," said Stephanie Saad Cuthbertson, director of product management for Android, during the developer keynote at Google I/O 2017. "...With Kotlin, there' …

  1. Anonymous Coward
    Anonymous Coward

    What happened to golang?

    Wonder why they chose Kotlin over golang? I was waiting for golang to become a common language for Android development, so glad I just learned my Python in the meantime. Let's see how the adoption of this interesting JVM-based language from Russia goes. I've never heard of it until today, and it has some interesting features; like compiling into JavaScript source, and null-pointer safety. Always fun to check out a new lang.

    https://en.wikipedia.org/wiki/Go_(programming_language)

    https://en.wikipedia.org/wiki/Kotlin_(programming_language)

    1. oldtaku Silver badge

      Re: What happened to golang?

      First, Kotlin is explicitly designed to be extremely interoperable with Java. You can call back and forth, no problem - you could think of it as extreme syntax sugar for Java. That makes it pretty easy to add support.

      Second, I'd bet they're already bored of Go-lang. Remember the programming mayflies descending on Ruby in swarms (I have nothing against Ruby, just the gadflies), making it briefly rival Python in popularity (and talk of Python-killer, lawl), and then they all got bored and ran off to the next hotness, leaving Ruby as 'that domain specific language for Rails'?

      Go-lang is 10 years old and people know about it, so it's booooooring - on to the next hawtness! Kotlin is 6 years old, but someone from Google probably found out about it only 2 years ago and is enamored. Though now that it's officially supported it's boring again.

    2. NB

      Re: What happened to golang?

      Golang is primarily a devops language. It's great for writing REST APIs, container systems and data crunching but library wise it's not a great fit for graphical applications and the like. It also still has yet to really get up to speed with package management and library versioning.

      I love Golang, it's my primary language but it really fucking needs a package manager along the lines of CPAN/npm/cargo etc...

    3. Kevin McMurtrie Silver badge

      Re: What happened to golang?

      Golang makes awesome demos but it feels very crude once your development gets going. It's the simplicity of the old languages with the restrictions of modern languages. Imagine trying to build a house using only a hammer, a shovel, and a saw while somebody watches over your back to make sure that you never misuse either. You manage to make slow progress until it's time for the interior, plumbing, and electrical.

  2. Aitor 1

    Benefits?

    How would I benefit from this? I dont see a good reason to move, and lose my Java skills, those that keep me fed...

    1. Anonymous Coward
      Anonymous Coward

      Re: Benefits?

      The days when most platform shared the same languages, instead of each platform developing its own language, where IMHO far better... it's just another way to ensure a full lock-in.

    2. deftelf

      Re: Benefits?

      You're not going to lose your Java skills, unless you have the memory of a goldfish. It knocks off many of the rough edges to Java (especially Java6, which Android is stuck on).

      Much more useful syntax in my opinion, eg properties, auto typed variables, lambdas, no primitive types (atleast not from a programmers perspective)... without alot of the verbosity that Java has. And crucially it still compiles down to bytecode so the safety is still there, and the same meaning is still there, it's not dynamic or anything scripty like that, it's still safe.

      Pretty easy to learn for a Java programmer, because all the under-the-hood stuff is the same.

  3. Frumious Bandersnatch

    static vs dynamic typing

    Um, aren't Java and C++ both statically typed? (Sure, C++ still has raw pointers and casting, but still...)

    1. oldtaku Silver badge

      Re: static vs dynamic typing

      I think someone confused Java and Javascript for the 10 millionth time. Marketing working as designed! (So well they still can't get anyone to call it ECMAscript).

      1. Filippo Silver badge

        Re: static vs dynamic typing

        Finding a name that could actually be pronounced, instead of "ECMAScript", would have helped a lot.

        1. Random Handle

          Re: static vs dynamic typing

          >Finding a name that could actually be pronounced, instead of "ECMAScript", would have helped a lot.

          I always thought it was pronounced ecmascript - what is it supposed to be - eczma script - Xmas crypt ?

          1. Anonymous Coward
            Anonymous Coward

            Re: static vs dynamic typing

            "Eck, ma script" is borked (said in a Scottish accent).

  4. Anonymous Coward
    Anonymous Coward

    Surprised it took so long?

    Is offering up Kotlin their way of saying, "get ready for a non-Java future?" Just curious...you'd think with Big Red being so litigious n all, that Google would have executed on a game plan to get out of Java some time ago.

    1. oldtaku Silver badge
      Thumb Up

      Javaless Future

      They are working on ditching Java and Linux, yes. They're developing a new OS called Fuschia and while it might start out with Java compatibility the point is to get rid of the legal nightmares (and Java is no longer fad of the month, it's just the new COBOL - no fun).

  5. cdrcat

    Steve Yegge explains why he likes Kotlin:

    http://steve-yegge.blogspot.com/2017/05/why-kotlin-is-better-than-whatever-dumb.html

  6. John Smith 19 Gold badge
    Unhappy

    Statically typed languages. Whatever will they think of next?

    I'd ROTFLMFAO if someone did an Ada implementation for Android devices.

    Statically typed, spec for full development environment as well as just the language and a back end language (DIANA) to help tools share data consistently and potentially allow round trip engineering. Contrary to popular belief Ada does allow pointers (access variables, which can be constrained to never be null) but does not encourage them.

    1. Adam 52 Silver badge

      Re: Statically typed languages. Whatever will they think of next?

      The goal was to reduce verbosity...

  7. Bob Vistakin
    Big Brother

    Aha! That's what "O" stands for in the new release then

    "O"ff you fuck, Oracle. We don't need no stinkin' java round here anymore.

  8. Simon Harris
    Joke

    "single Kotlin line could accomplish the same thing as 87 lines of Java"

    That's nothing - I can write a single line of C++ code that accomplishes the same thing as 1000 lines of Java...

    ... Ok, so it might be 30000 characters long, but it's still a single line.

    1. Stephen 1

      Re: "single Kotlin line could accomplish the same thing as 87 lines of Java"

      I've written an entire mission system in one line of C++ (since we seem to be ignoring the fact that both Kotlin and Java are just fronts for the virtual machine with its millions of lines of code - much of it in err, C++).

    2. WillC

      Re: "single Kotlin line could accomplish the same thing as 87 lines of Java"

      Sorry to resurrect an old thread (yeah, I know >.<) but I wasn't able so far to find this particular claim / example (I might have missed a talk given there appear to have been so many). Can anyone point me to the particular presentation?

  9. DropBear
    Alien

    " It's also null-safe, meaning it can handle null references without throwing an exception."

    Wait, what...? This thing tracks whether you checked for null in your code just prior to use, and accepts or throws an error at compile time accordingly...? But decades of programming have conclusively demonstrated that null pointer errors are impossible to defend against! Hey, Tsoukaloooooooooos! Over here! I've gots tangible proof we're using alien technology! Roswell was real after all!

  10. GrapeBunch
    Paris Hilton

    Noob question

    Noob question. Maybe it's even a pre-noob question. It's not just Kotlin that does this, but other languages, and I've never found an explanation in the typical Hello World beginner documents:

    package hello

    fun main(args: Array<String>) {

    println("Hello World!")

    }

    In annotating fun main(args: Array<String>), the Kotlin frontpage describes it thusly: "Package-level function, which takes an Array of strings as a parameter".

    "Hello World!" is a string. So why do you need to create a program(me) argument, an array of strings, that you aren't going to use in the program proper? My first thought was that it allows you to set some sort of errorlevel. Second thought: required by the built-in function println. Thanks in advance for the real answer ....

    1. Pseu Donyme

      Re: Noob question

      I suppose args has a similar purpose to argc and argv in C main(): the program gets the arguments it is invoked with (if any) trough this. In your example they are not used for anything, but they could be so they are part of the interface / function signature of Kotlin's main().

      1. TheOldBear

        Re: Noob question

        It's the standard program entry point, expected by the JVM.

        This is exactly equivalent to the normal Java entry of

        public static void main(String [] args){

        //main method may use or ignore args

        }

    2. Kevin McMurtrie Silver badge

      Re: Noob question

      A Java method signature both its name and its arguments. Remove the argument list and it's not the same method anymore.

      Java app launching used to look for multiple permutations of the main method so you could leave off the arguments. It was more confusing than useful so that feature was removed.

    3. John Smith 19 Gold badge

      "So why do you need to create a program(me) argument,"

      This is exactly like the equivalent line in C.

      All programs in C are called (inside the source code file) "main" (IIRC something similar was the case for FORTRAN, so this is a pattern that's been around for decades)

      All programs in C (and by extension this language) are passed an array of strings. Parameter 0 is the name the program was called by. The rest are any command line parameters passed to it.

      Normally the start line is a piece of boiler plate code devs will keep in a file of snippets when they start a new project. People have found that most programs, sooner or later need the ability to be started with some kind of configuration data. (right click an an icon on a Windows desktop and see what a programs parameters are and exactly how it's called. You may be surprised at what happens before the first window even opens).

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like