Home » JVM Languages

JVM Languages

Defending Public-By-Default in Kotlin

Some people have spoken against Kotlin’s decision to make classes, methods, etc. public by default (when no visibility modifier is used), and I would just like to pitch in on why I think JetBrains made the right decision on this one. Those who are against it bring up the principle of hiding everything that you can get away with in ...

Read More »

10 reasons to Learn Scala Programming Language

One of the questions my reader often ask me is, shall I learn Scala? Does Scala has better future than Java, or why Java developer should learn Scala and so on. Well, there can be many reasons for learning Scala e.g. you are forced to learn because it been used in the new company you joined or your solution architect ...

Read More »

Kotlin – Reified type parameters sample

This post walks through a sample that demonstrates Kotlin’s ability to cleverly reify generic type parameters. So consider first a world where Kotlin does not support this feature, if we were using the Jackson library to convert a JSON to a Map with String based keys and Integer based values, I would use a code along these lines: @Test fun `sample ...

Read More »

Run code on startup with Play and Scala

Depending on various projects, sometimes there is the need to execute some actions on initialization just before our application starts to serve requests. It was a common practice to call the functions that we wanted to get executed through GlobalSettings, however it is not recommended. The other way around to achieve this is to implement a class which will be ...

Read More »

Kotlin – Tuple type

It is very simple to write a Tuple type with the expressiveness of Kotlin. My objective expressed in tests is the following: 1. Be able to define a Tuple of up to 5 elements and be able to retrieve the elements using an index like placeholder, in a test expressed with 2 elements like this: val tup = Tuple("elem1", "elem2") assertThat(tup._1).isEqualTo("elem1") assertThat(tup._2).isEqualTo("elem2") ...

Read More »

Kotlin – Try type for functional exception handling

Scala has a Try type to functionally handle exceptions. I could get my head around using this type using the excellent Neophyte’s guide to Scala by Daniel Westheide. This post will replicate this type using Kotlin. Background Consider a simple function which takes two String, converts them to integer and then divides them(sample based on scaladoc of Try) : fun ...

Read More »

Gettin’ schwifty with Clojure’s core.async

A few months ago, somebody in the office pointed us to an interesting  job offer from CartoDB which looked as follows: What follows is a technical test for this job offer at CARTO: https://boards.greenhouse.io/cartodb/jobs/705852#.WSvORxOGPUI Build the following and make it run as fast as you possibly can using Python 3 (vanilla). The faster it runs, the more you will impress us! ...

Read More »

Recursion

Recursion is a technique that allows us to break down a problem into smaller pieces. This technique allows us to remove some local side effects that we perform while writing looping structures and also makes our code more expressive and readable. In this post we will see why it is a very useful technique in functional programming and how it can help ...

Read More »

Exclusive Book Offers (75% off): Big Data Analytics with Java, Scala and Spark for Big Data Analytics, Big Data Visualization

Hello fellow Geeks! Today, we have some exciting news for you! Java Code Geeks and Packt have teamed up to offer you weekly discounts on their extensive library of books. This week, we are offering discounts on three books to help you understand and master Clojure. Check them out! Big Data Analytics with Java By Rajat Mehta This book covers ...

Read More »