Data Driver

Blog archive

As Kotlin Ascends, What Are Options for Visual Studio Devs?

Kotlin is a hot programming language right now, and its eclipse of Java for Android mobile development might leave Visual Studio developers wondering how they can get in on the action.

The already well-documented rise of Kotlin -- after being named a first-class language for Android by Google at its I/O conference in May -- is further chronicled in a new report from mobile database company Realm. Culling data from its large user base, Realm just today published its inaugural "Realm Report" to analyze choices developers make on programming tools, languages and platforms.

For languages, there's no doubt about which one has the momentum.

"It's clear: Java (on Android) is dying," the report said. "There aren't simply more Kotlin builders: they're also switching their apps to Kotlin. In fact, 20 percent of apps built with Java before Google I/O are now being built in Kotlin. Kotlin may even change how Java is used on the server, too.

"In short, Android developers without Kotlin skills are at risk of being seen as dinosaurs very soon."

Realm Says: Kotlin is about to change the whole Android ecosystem
[Click on image for larger view.] Realm Says: 'Kotlin is about to change the whole Android ecosystem' (source: Realm).

Google, in describing its views on "Kotlin and Android," has said this:

We have been watching Kotlin adoption on Android steadily rise over the years, with increasing excitement among developers. Kotlin is expressive, concise, extensible, powerful, and a joy to read and write. It has wonderful safety features in terms of nullability and immutability, which aligns with our investments to make Android apps healthy and performant by default. Best of all, it's interoperable with our existing Android languages and runtime. So we're thrilled to make Kotlin an official language on Android.

So what can Visual Studio developers do to avoid becoming dinosaurs -- or at least use Kotlin for Android programming? The answer is: not much.

Kotlin Gains in Popularity
[Click on image for larger view.] Kotlin Gains in Popularity (source: Stack Overflow Trends)

With Visual Studio, Android development is primarily done with C# via Xamarin, or with JavaScript via Cordova. The VS approach emphasizes cross-platform functionality, seeking to let coders create mobile apps for Android, iOS and Windows while using much of the same code base.

The truth is, even with Microsoft's transformation into a more open company that embraces alternative technologies, the Visual Studio ecosystem is just now catching up to Java, soon to be subsumed by Kotlin!

Realm Says: Kotlin is about to change the whole Android ecosystem
[Click on image for larger view.] What Languages Are Mobile Developers Using? (source: Realm).

For example, last month, JNBridge -- which as its name suggests is a specialist in bridging the Java/.NET camps -- announced it will offer Java coding in the Visual Studio IDE with an upcoming Java.VS extension.

And on the Visual Studio Code editor side of things, the somewhat more robust Java offerings include the brand-new Java Debugger for Visual Studio Code.

In fact, the open source VS Code is obviously and logically the go-to choice for coding in other languages, including Kotlin.

But there isn't much in the Visual Studio Marketplace for Kotlin for VS Code.

Here's a look at the two main Kotlin offerings available for VS Code:

Kotlin Language
This extension comes from developer Mathias Fröhlich, providing Kotlin language support for VS Code -- basically a syntax highlighter for the Kotlin language. Fröhlich credits the open source Kotlin Sublime Text 2 Package, so his extension is likely based on that.

As of this writing, the extension has been installed in VS Code 20,475 times, being reviewed only once.

On the project's GitHub site, it has garnered 41 stars, with 17 commits coming from four contributors. It was last updated in July.

Code Runner
Coming from developer Jun Han, this tool isn't Kotlin-specific -- rather, it lets VS Code users run code snippets or code files coming in 35 different programming languages. Kotlin is the latest addition to that extensive list.

Kotlin in Code Runner
[Click on image for larger animated GIF.] Kotlin in Code Runner (source: Jun Han)

Code Runner provides the following features:

  • Run code file of current active Text Editor
  • Run selected code snippet in Text Editor
  • Run custom command
  • Stop code running
  • View output in Output Window
  • Set default language to run
  • Select language to run
  • Support REPL by running code in Integrated Terminal

Code Runner's new support for Kotlin was announced in a blog post on the Microsoft developer site.

"In recent Google I/O 2017, Kotlin has been announced as the [actually, just "a"] official development language of Android by Google," says the post authored by "formulahendry." "And now, it's time to support Kotlin in Code Runner!

"Kotlin tools will be included with Android Studio 3.0 by default, and JetBrains and Google are pledging to support the language going forward. Kotlin as a language has a lot of similarities to Java in structure. Moreover, Kotlin adds a lot of nice-to-have features, a much cleaner syntax, ideas from functional programming, and other enhancements over Java. Come to VS Code and have a try!"

The Code Runner extension has been installed 1,400,722 times and has an average rating of 4.7 (out of 5) from 60 reviewers.

The project's GitHub site shows 208 stars, 95 commits, 57 releases and 15 contributors. The last commit was six days ago.

More Resources
So there you have it. While Kotlin doesn't have as much VS Code support as some other popular languages, you can install extensions to highlight Kotlin syntax and run Kotlin code snippets or files upon command.

If it's any consolation, searching for Kotlin in the full-fledged Visual Studio IDE section of the marketplace brought up 0 results. Microsoft is apparently keeping its focus on C# and JavaScript cross-platform solutions, even though the Windows Mobile component of that approach is apparently dead.

So it looks like Android development with Kotlin might be better left to Google's default IDE, Android Studio.

That's basically the conclusion of a discussion the Kotlin site titled "How many IDEs are available to write Kotlin code for Android?"

One answer to that question said: "You can program in Kotlin using a text editor such as Sublime Text or Visual Studio Code, and build your programs using Gradle from the command line. You won’t have access to a debugger, though; debugging is only available in Android Studio."

Luckily, there are plenty of resources to consult for Kotlin programming with that tool. Here's a list:

BTW, for non-Kotlin Android development in VS Code, there's an "Android for VS Code" extension. Its description says: "This is a preview version of the Android for VS Code Extension. The extension allows developers to install, launch and debug Android Apps from within the VS Code environment."

Posted by David Ramel on 10/10/2017


comments powered by Disqus

Featured

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

  • TypeScript Tops New JetBrains 'Language Promise Index'

    In its latest annual developer ecosystem report, JetBrains introduced a new "Language Promise Index" topped by Microsoft's TypeScript programming language.

Subscribe on YouTube