Coding Languages for Fintech: How Will JVM Make You Succeed?

Coding Languages for Fintech: How Will JVM Make You Succeed?


January 5, 2021


BellSoft Blog Disclaimer

BellSoft is rounding up 2020 with top languages for fintech enterprises. Whether you’re a startup launching your very first MVP, an up-and-coming business, or an established company looking for an innovative edge, this list is guaranteed to answer all your IT needs.

Here we’ll explain why you should choose JVM languages over platform-specific native ones, look into their key features and rankings. We’ll be paying special attention to how the languages are applied to use case scenarios, covering everything from finance & banking to insurance. This list will help you understand the advantages and opportunities each one offers. You can follow our advice when selecting the programming language best suited for your project.

Introduction

For this comparative study, we’ve collected data from various sources that rank languages by different parameters:

  • the TIOBE Programming Community Index,
  • PopularitY of Programming Language Index (PYPL),
  • JetBrains, Stack Overflow, and GitHub developer surveys.

Our research only covers 2020 so that you get the most relevant industry profile — since being current is vital in fintech!

But first, we’d like to explain our focus for this article. Many would say that Python is best for a financial technology company, thanks to its developer-friendly nature and adaptability. While that may be true, it lacks certain benefits for high-risk businesses. Historically, it’s Java that has been widely used by financial institutions. Viewing data security, productivity, and stability as their priorities, they often turned to Java-based languages.

In 1995, James Gosling introduced Java as a high-level object-oriented programming language. One of its key features since the beginning has been platform independence, which came with the Java Virtual Machine (JVM). The JVM abstracted away from the low-level physical hardware and operating systems. With this efficient way of executing programs, Java developers did not need to focus on object lifecycle management or other low-level complications. Instead, they were able to direct all their efforts to the business logic.

Over the years, JVM has improved significantly in terms of garbage collection, performance, and maturity. Programming language designers realized the potential of this runtime. And thus, many prominent, mainstream, and even newer languages have developed with the features and immense class library both provided by JVM. Every enterprise can now find a solution that would meet their needs.

There was slight uncertainty within the IT community regarding the JVM status when Oracle introduced the subscription-based licensing for JDK in July 2018. Fortunately, the JDK spec is still license-free and open source, thanks to the OpenJDK initiative. Several companies are now providing their own open source Java SE implementations, including BellSoft. Its Liberica JDK is one of the leading runtimes on the market with optional enterprise support.

Now that we have the history covered, it’s time for our piece de resistance: a list of the best JVM languages for the financial technology industry: Java, Kotlin, Groovy, Scala, and Clojure. You will not find it too difficult to guess the first one…

1. Java

Java is the primary choice for business application development and one of the top major languages. It was the first to conceive and widely accept the “Write once, run anywhere” paradigm focusing on developer productivity and ergonomics. It paved the way for the success of others like Python, JS, and Kotlin. Java has adopted many pragmatic concepts like memory model, intermediate representation (ByteCode), multithreading, and handling functions as first-class citizens. One of the most disruptive and influential programming languages to date, Java has forever changed the software development landscape.

Let’s look into why it is now almost as successful as it was 25 years ago:

  • Java has holistic backward compatibility, which is a highly valued feature in business software development. The Java code written two decades years ago still runs in the latest JDK.
  • It is statically typed and supports multiple paradigms (object-oriented, functional, imperative).
  • Because of its massive adoption in the industry, whether it is commercial software, an Android app, big data application, or an IoT device, Java possesses one of the richest and powerful ecosystems, having many libraries and frameworks in all domains.
  • Java is the “lingua franca” in data-intensive applications. Most of the industry’s leading DIAs (e.g., Hadoop, HDFS, Solr, Lucene, Flink, Cassandra) are in Java, as mentioned here.
  • Widely used in the industry, by tech giants and startups alike, Java is here to stay.

Stable and reliable

N26, a German neobank offering its services in the Single Euro Payments Area and the US, uses Java (RxJava, to be specific) to build Android applications.1 It provides a standard workflow to manage all data and events across the application. That’s the reason behind its rising popularity among Android developers. The engineering team achieved a clean separation of concerns, which made the features easier to navigate in code and improved code review.

Take a look at a short snippet from the app’s feature to display a list of the user credits drafts:

Flowable<Option<List<CreditDraft>>> getAllCreditDrafts() {
   return store.getAll();
}

Completable fetchCreditDrafts() {
   return creditService.getCreditDrafts()
                       .subscribeOn(Schedulers.io())
                       .observeOn(Schedulers.computation())
                       // map from raw to safe                                
                       .flatMapObservable(Observable::fromIterable)
                       .map(creditDraftMapper)
                       .toList()
                       // put mapped objects in store
                       .doOnSuccess(store::replaceAll)
                       .toCompletable();
}

Java isn’t built for mobile development? We would like to disagree. A banking system, whether it runs on servers or in the cloud, must be robust and able to work consistently for many years without a need to tweak this and that. Here Java is the ideal language with a large, mature ecosystem and non-breaking changes.

Java is by far the most used technology in Enterprise and backend development. The majority of popular programming language ranking sites tend to put it at the top.

TIOBE, specialized in assessing and tracking the quality of software, named Java the second most popular language of 2020 and one of the top two most popular languages over the last 20 years! During this period, it has only been surpassed by C a couple of times.

TIOBE Statistics

For 2020, PYPL (PopularitY of Programming Language Index), based on Google Trends data, listed Java as the second most popular programming language behind Python. And here we’d like to point out that Java only lost the lead in 2018.

PYPL Statistics

Also, JetBrains’ fourth annual developer survey placed it second, just behind JavaScript.

JetBrains 1

Verdict

Java is facing stiff competition from Python and JavaScript. It will probably never have the same market share it once had in the industry. However, the developers still view learning Java as a secure investment for the future since the number of job openings is as high as ever. And considering the amount of Java’s adoption and its many recent innovations, it will remain the number one choice for business software development going forward.

2. Kotlin

In recent times, Java received much criticism regarding developer experience and ergonomics: It is verbose, produces boilerplate code, prone to accidental features, and lacks many modern features. Several other languages tried to address those shortcomings, striving to become “better Java.” We strongly believe Kotlin is the best of them.

JetBrains, the company behind the popular IntelliJ IDE, released Kotlin in 2016. It tried to solve Java’s issues without compromising the compile time. Kotlin has introduced many excellent features from other state-of-the-art and highly productive languages. It is considered a much simpler, modern, concise alternative to Java.

Android and many Enterprise apps support older, LTS versions of Java. In such use cases, Kotlin provides the developers more powerful modern language features as Kotlin can target a wide range of older JDK versions (such as Java 6 or 7).

Kotlin received a significant boost in 2019 when Google declared it as the preferred Android app development option. But why is it so fast-growing?

  • Kotlin is statically typed and supports multi-paradigm (object-oriented, functional).
  • It has introduced many modern features in JVM like Type Inference, Null Safety, Data Classes, Extensions, Coroutines. With its clean design, Kotlin resembles Python on JVM in terms of developer productivity.
  • As the preferred language to develop for Android, it has already surpassed Java with a 60% market share in this field.
  • The industry gave it a warm welcome. Many Fortune 500 companies are adopting Kotin, including the tech giant Google.
  • Although Kotlin was developed mainly as a JVM language, it has recently widened its target platform support. Today it can be compiled to JavaScript, Native Code (via LLVM).

The best of both worlds

Mastercard entered a partnership with Corda to develop and pilot a new blockchain-enabled cross-border payments solution.2 It connects global fast payments infrastructures, schemes, and banks supported by a Mastercard-operated clearing and settlement network. Corda is an open source blockchain project written in Kotlin for storing, managing, and synchronizing financial obligations between various financial institutions.

This example is taken from the Corda project:3

// Add this import:
import net.corda.core.identity.Party

// Replace TemplateState's definition with:
@BelongsToContract(TemplateContract::class)
class IOUState(val value: Int,
               val lender: Party,
               val borrower: Party) : ContractState {
    override val participants get() = listOf(lender, borrower)

}

If the team wanted to leverage innovation, on the one hand, and sustainability provided by the JVM, on the other, Kotlin is ideal. This language attracts companies for its progressive features, flat learning curve, and higher development velocity in comparison to Java.

On the rise

First released in 2016, Kotlin is gaining popularity and is becoming a top trending language. As of December 2020, it ranked 13th on PYPL, just behind TypeScript and Go. Seeing it above such powerhouses as Ruby (14th) is already a rather impressive result.

Kotlin is designed for better developer ergonomics and enjoyed globally. It is the 4th most loved language for nearly 63% of respondents, just behind Python, as per the Stack Overflow 2020 Developer Survey.

With a 182% year-over-year increase between 2019 and 2020, it is one of the fastest-growing programming languages worldwide, according to the GitHub Octoverse.

JetBrains 2020 Developer Survey stated that Kotlin is among the top three languages developers want to migrate to and adopt as their primary tool:

JetBrains 2

Verdict

Kotlin is one of those rare instances that strike the right balance between cool features and simplicity. It will definitely see more popularity next decade. Kotlin is an excellent choice for curious minds who want to learn a highly productive language or try Android app development. Some even claim that betting on Kotlin would be a smart move in the near future. You can read more about its features and what this language means for the industry in BellSoft’s two-part series about Kotlin.

3. Groovy

In specific scenarios, dynamically typed languages have a significant advantage over statically typed ones from the standpoint of development speed. Inspired by Python and Ruby, James Strachen started to develop dynamically typed programming for JVM in 2003. Four years later, Groovy saw the light of day as the first of its kind. It has introduced Python-like clean coding combined with Ruby-like dynamism.

Groovy is a respectable language choice and widely used for the following reasons:

It is optionally typed and multi-paradigm (object-oriented, functional, imperative, scripting).

Groovy has brought many pragmatic features: type inference, multi-line strings, closures, prototype extensions. This approach later heavily influenced other languages, like Kotlin.

  • It is seamlessly compatible with Java and boasts a colossal ecosystem of libraries. Many popular frameworks, such as Spring, support Groovy.
  • It can be used for Domain Specific Language (DSL). It also has support for implementing traits at runtime.
  • Dispatching methods through the meta-object protocol instead of calling them directly makes it highly performant.
  • Groovy is now part of the Apache software foundation and is massively used in the industry. It is ideal for scripting, tooling, and DevOps for its dynamic, concise nature. Popular tools like Gradle, Jenkins, and SoapUI use Groovy as the primary programming language. Being in DevOps and Architecture domains also extends its lifetime.

Speed is key

The Australian-based Auto & General Insurance Company Ltd. needed internal tooling to manage its DevOps system.4 It planned to create a Maven archetype-like plugin for Gradle that generates projects from local templates. For this small-scale project that other systems rely on, rapid development is of utmost importance. Groovy is the perfect fit for interoperating with the company’s existing tools thanks to its dynamic nature, support for DSL, and high adoption in the DevOps domain.

Little goes a long way

Groovy is a mature programming language offering Python-like productivity in JVM. This combination proves its advantage for a variety of smaller tasks: tooling, scripting, proof of concept development. Hence its relatively high popularity regardless of not being a general-purpose language like Java or Kotlin.

On TIOBE, Groovy moved its position from #12 to #11 in December 2020.

However, the PYPL index ranked Groovy as 23rd the same month: it seems that 0.45% market share is not something to boast about.

Verdict

Optionally typed Groovy is not for large-scale development: its benefits lie in fast delivery and dynamism. Method caching and other pragmatic features are the secrets behind the neat performance. Enterprises consider Groove a well-established language that will have its share of users no matter what.

4. Scala

The JVM veteran Martin Odersky, who worked on Java Generics and current Java compiler javac, decided to work on Java’s drawbacks. In 2004, he released Scala that combined many functional programming features with the object-oriented paradigm. It became one of the earliest languages targeting JVM as a runtime platform. Scala has successfully accelerated technological advancements and directly contributed to the recent modernization of Java. The industry would not be the same without this language: it has played a critical role in popularizing the functional programming paradigms in the last decade.

What are its features?

  • It is statically typed and has a multi-paradigm model (object-oriented, functional, concurrent, imperative).
  • Many functional programming features have been introduced with Scala, such as currying, immutability, lazy evaluation, pattern matching, type inference from Haskell, and Standard ML.
  • With its functional programming features, immutable collections, and concurrent support, it is heavily used in data-intensive applications. Some of the world’s best batch and stream processing applications (Apache Spark, Apache Kafka) are written in Scala.
  • Although it was developed mainly as a JVM language, Scala can be compiled to other intermediate representations: JavaScript, Native Code (via LLVM), etc.
  • It has gone through a major overhaul in Scala 3 (Dotty), addressing various criticisms and pain points. Scala 3 is more opinionated, simpler, predictable, and stable. It’s got rid of several obsolete features and reduced compile time.

Skyrocketing performance

In 2016, PayPal implemented Scala as a part of their system to increase the amounts of transactions it could receive.5 Based on Akka (a runtime and toolkit to simplify the building of apps on the JVM) with Akka Streams and powered by Scala with Kafka; their new open source squbs platform showed incredible results. Applications served a billion+ hits a day “with as little as 8 VMs and 2 vCPU each.” Before, with a Spring/Java combination, the company’s performance was almost one-tenth of what the team achieved.

PayPal’s requirements for the tech stack were:

  • horizontal and vertical scalability,
  • near-real-time performance,
  • efficient resource usage (most likely for cloud deployments), and
  • resiliency under high burst.

Below you see a perpetual stream that starts and stops with the system. It provides a convenience trait to help write streams controlled by the system lifecycle with minimal to no message losses. It provides customization hooks and killSwitch (from Akka) to be embedded into the stream.

class MyStream extends PerpetualStream[Future[Int]] {
    def generator = Iterator.iterate(0) { p =>
        if (p == Int.MaxValue) 0 else p + 1
    }
    val source = Source.fromIterator(generator _)
    val ignoreSink = Sink.ignore[Int]

    override def streamGraph = RunnableGraph.fromGraph(
        GraphDSL.create(ignoreSink) { implicit builder =>
          sink =>
            import GraphDSL.implicits._
            source ~> killSwitch.flow[Int] ~> Sink
            ClosedShape
        }
    )
}

Here Scala fits nicely with its functional programming features and potential interoperability with leading streaming platforms like Apache Spark and Apache Flink.

Always finds its purpose

Even though Scala was released with a lot of optimism and was deemed to overtake Java, it has remained a special-purpose language. We see its adoption flattening in the past five years. But in its domain, data-intensive applications, and stream processing, Scala edges out almost all others, including Java or Kotlin. Moreover, many acclaimed and prevalent frameworks and runtimes support the language (e.g., Akka, Play, Finagle, Lagom), proving its strong foothold in the industry.

Verdict

Scala had a say in improving Java and influenced many other modern languages, including Kotlin; but it has not gained broader acceptance. Its many breaking changes that had been introduced over the years were not well received in the Enterprise. The one thing it’s really good at is stream processing, which is shown by the PayPal use case above. Scala 3, the latest release, finally adapts pragmatic features to become a more mainstream language. We do hope this version has the potential to make it general-purpose and used on a wider scale.

5. Clojure

Lisp was one of the first-ever high-level programming languages, released in 1958. Much later, Rich Hickey, a noted software engineer, worked to create a dynamic and functional dialect of Common Lisp to target JVM, which became Clojure. Unlike Scala that combines the object-oriented and functional paradigms, Clojure is a pure functional language. It has a Lisp macro system, treats code as data, and programs as models. Clojure encourages immutability and immutable data structures, as well as being explicit about managing identity and its states.

We may summarize its main characteristics as follows:

  • It is dynamic, agent-oriented, and functional.
  • By default, it has an immutable data structure and support for tail recursion.
  • As a Lisp variant, Clojure also supports Code as Data, i.e., code can be modified automatically at runtime with the Lisp macro system.
  • Like Scala and Kotlin, Clojure also can be compiled to other intermediate representations, such as JavaScript and .NET. ClojureScript has influenced new functional languages targeting JavaScript (e.g., Elm).
  • With its immutable core data structure, software transactional memory system (STM), and Atoms (shared, synchronous, independent state), Clojure excels at concurrent and parallel programming.

Micro-level analysis

Nubank, the largest Fintech in Latin America that became a unicorn startup in 2018, has developed a Double Entry Accounting system with Clojure.6 The company claims it to be “an ancient technology used for centuries,” which wonderfully connects with this functional programming language. Among its requirements, Nubank mentioned that the language should be capable of parallel processing, provide maintainable code, and manage invariables.

Here’s a part of code that showcases declarative rules for movements.

(def new-purchase
    [{:entry/debit-account    :book-account.asset/settled-brazil
      :entry/credit-account   :book-account.liability/payable-brazil
      :entry/amount           (comp :amount :purchase)
      :entry/post-date        (comp time->date :time :purchase)}


      {:entry/debit-account    :book-account.liability/payable-brazil
        :entry/credit-account  :book-account.profit-and-loss/interchange-brazil
        :entry/amount          (comp :interchange :purchase)
        :entry/post-date       (comp time->date :time :purchase)}


      {:entry/debit-account    :book-account.liability/current-limit-counterparty
        :entry/credit-account  :book-account.asset/current-limit
        :entry/amount          (comp :interchange :purchase)
        :entry/post-date       (comp time->date :time :purchase)])

Such a system allows proceeding analysis of a specific user or groups of users by any criteria behavior. For instance, the company can predict how much its customer will spend next year.

Perfect for greenfield

Clojure is getting popular with companies working on large-scale projects from scratch thanks to its speed of development and clean code. It is an excellent language for specific use cases (e.g., concurrent programming, big data projects); slowly but steadily, it’s gaining traction in the industry. Still, Clojure is not yet a general-purpose, mainstream programming language.

Verdict

Although Clojure is excellent at what it does, it lacks the pragmatism of Kotlin or Groovy. A universal language for Enterprise needs both object-oriented and functional paradigms. We predict that Clojure will not go beyond its scope and remain special-purpose.

Summary

JVM is, by far, the most widely used process virtual machine. It is powerful, battle-hardened, and it has passed the test of time. In this article, we have explained how fintech companies can benefit from JVM’s versatility and summarized the top 5 JVM-based languages, each with its strengths and particular use cases.

BellSoft JVM Languages

Any business task is possible with one of these five options. You can rest assured that in any case, your solution will be performant, implement fast, and stay relevant for many years to come.

If you would like to learn more about how JVM-based solutions can advance your business, contact BellSoft. The company’s engineers are willing to share best practices collected over the decade of working in the JDK world. They’ll be happy to answer all your questions and provide the Progressive Java Runtime that will satisfy your needs.

References

  1. n26/N26AndroidSamples · GitHub
  2. Mastercard and R3 Partner to Develop New Blockchain-Powered Cross-Border Payments Solution
  3. Corda · GitHub
  4. Auto & General Insurance Company Ltd. · GitHub
  5. PayPal Blows Past 1 Billion Transactions Per Day Using Just 8 VMs With Akka, Scala, Kafka and Akka Streams
  6. Building a powerful Double Entry Accounting system - Lucas Cavalcanti
Author image

Md Kamaruzzaman

Software Architect, Special for BellSoft

BellSoft LTD [email protected] BellSoft LTD logo Liberica Committed to Freedom 199 Obvodnogo Kanala Emb. 190020 St. Petersburg RU +7 812-336-35-67 BellSoft LTD 199 Obvodnogo Kanala Emb. 190020 St. Petersburg RU +7 812-336-35-67 BellSoft LTD 111 North Market Street, Suite 300 CA 95113 San Jose US +1 702 213-59-59