Skip to content

What’s great about Kotlin, aka ‘Java without the warts’

    
What’s great about Kotlin, aka ‘Java without the warts’

Ever wonder why the financial industry is so hopped up on Kotlin? 

Kotlin is a modern, statically typed programming language that developers use to help boost productivity, developer satisfaction and code safety. In this episode of the Code Patrol podcast, we take a look at Kotlin — its digital roots, why it rose to popularity and how you can use it in your application today — with Contrast Security Senior Technical Product Manager Utsav Maheswari.

As you might know already, Kotlin is a popular programming language that’s gained a lot of attention in recent years, particularly in the financial industry. 

It’s a modern, concise and versatile language that can be used for a wide range of programming tasks. It’s known as being fully compatible with Java — as in, 100%, as in, “you can switch from Java to Kotlin with no bitter aftertaste.” Compatibility is the predominant reason why it’s so popular: Given that Java is the dominant language in the financial industry, it’s easy for developers to seamlessly switch from Java to Kotlin. 

“The 100% compatibility with Java is a big draw for FinTech and banks, as banks and FinTech have grown large Java ecosystems in the last few decades,” Maheswari explained. “It's an easy transition from [the Java] ecosystem. Any code written in Kotlin can be (maybe) used in Java, and vice versa.”

Kotlin’s also compatible with other languages, such as  Python and C++. This compatibility makes it easier for financial institutions to modernize their systems while still maintaining compatibility with older technology. 

Make mine a skinny 

Another sweet flavor note: Kotlin's syntax is cleaner and more concise than Java’s, which can lead to more efficient coding and less code bloat. Specifically, programs written in Kotlin contain, on average, about 40% fewer lines of code. 

Do developers love that, or what? “Yeah, absolutely,” Maheswari enthused. “Kotlin is a far more concise language than Java, [and developers love that] because it simplifies their work.” 

In fact, one engineer told him that he and his team have managed to cut a code base of 50,000 lines down to about 20,000, with no functionality loss. 

The benefit of less code is that, at least sometimes, it means less errors. In fact, development in Kotlin “has been a dream” compared with what the engineer told Maheswari is Java’s “ham-fistedness.” 

“That's good for the bottom line,” Maheswari said. “Because you have to write fewer lines of code, there's less chance to get in trouble and to get errors than you would in Java.”

The compatibility between Kotlin and Java, added to the fact that Kotlin is more concise, makes it an easy sell to FinTechs and banks, given how enormously important scalability is to the industry, Maheswari added. 

“Think about the volume of transactions they have to deal with,” he said. “According to recent statistics, the FinTech sector is attracting about 50 billion investments every year. And two-thirds of those financial transactions are made online, compared with Java. Compared with Java, Kotlin has pretty much no overhead at compile time. This allows for server-side obligation to save massive numbers, enabling billions of transactions to occur.” 

Kotlin: ‘Java without the warts’

Kotlin has what’s been called a “cult-y vibe” — like Java “with some minor warts removed.”

The language was initially developed by JetBrains, a software development company based in St. Petersburg, Russia. According to developer Jay Tillu, the inside story of Kotlin’s creation was that the JetBrains team was saddled with a load of applications written in Java — apps that bogged down developers, since they needed to write a lot of boiler-plate code. That code  “eventually becomes hard to write, read and maintain,” he said.  

“Even the simplest code needs to declare full classes and objects and all that …  [and it became] a big headache for JetBrains developers,” Tillu explained. 

JetBrains’ teams wanted to use a more modern language and to ditch the extra, repetitive work required by the powerful Java language. But the need to maintain apps written in Java meant that it didn’t make sense to rewrite all the Java products to C# or any other language. “What they needed was a language that was compatible with Java, so they [could] keep all the old code as it is and can start creating new features in a new language,” Tillu said. 

The main purpose of Kotlin, first announced in 2011 and made public in a preview version in 2012, was to provide a more concise, expressive, and safe language for developing applications that run on the Java Virtual Machine (JVM) and elsewhere.

Reasons why Kotlin is so popular include its strong type system, which enables developers to write safer, more reliable code. The type system checks for errors during the compilation phase, reducing the likelihood of runtime errors and making it easier for developers to catch bugs early in the development process. This is particularly important in the financial industry, where accuracy and reliability are paramount.

As well, Kotlin’s popularity in the financial industry is due to its support for functional programming concepts. Kotlin has first-class support for functional programming, which can lead to more efficient and maintainable code. In particular, Kotlin's support for lambda expressions and higher-order functions can make it easier to write code that’s concise, expressive and easy to read.

Tune in

Are you sold on Kotlin yet? Want to know more? We got you: Have a listen to the podcast to hear all that Maheswari has to say on Kotlin — Java’s de-warted sibling. Listen, enjoy, share and please do let us know what you think at podcastideas@contrastsecurity.com. We’d love to hear from you. 

Listen Now

Lisa Vaas, Senior Content Marketing Manager, Contrast Security

Lisa Vaas, Senior Content Marketing Manager, Contrast Security

Lisa Vaas is a content machine, having spent years churning out reporting and analysis on information security and other flavors of technology. She’s now keeping the content engines revved to help keep secure code flowing at Contrast Security.