Before you go, check out these stories!

0
Hackernoon logoKotlin with types is more concise than JavaScript without types by@daveford

Kotlin with types is more concise than JavaScript without types

Author profile picture

@davefordDavid Ford

In general, dynamic languages (like JavaScript or Python) tend to be more terse then statically typed languages like Java. In fact, that is one of their key selling points. So I tried a little experiment.

I have a simple blackjack game that I create when learning (or teaching) a new language. I recently created a Kotlin version of the game and compared the lines of code to the JavaScript version of the game.

The Kotlin version of the game was 17% fewer lines of code than the JavaScript version.

This is surprising that a statically typed language was more concise than a dynamically typed language. In other words, Kotlin with type annotations is more terse than JavaScript without type annotations.

My next comparison will be Kotlin vs JavaScript with type annotations (i.e. TypeScript).

Dave Ford is a Software Developer and Trainer focusing on JavaScript, React and Kotlin. His company is Smart Soft. Connect with him on Twitter.

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.
To learn more, read our about page, like/message us on Facebook, or simply, tweet/DM @HackerNoon.
If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

Tags

The Noonification banner

Subscribe to get your daily round-up of top tech stories!