Home » JVM Languages

JVM Languages

Creating a YARN Application using Scala

I have been recently playing with Apache Amaterasu, which is an amazing project that helps to deploy data pipelines. It’s still incubating and has a super-friendly team of engineers working on it. Some exciting features are lined up. Don’t take my word for it. Please check it out yourself. Amaterasu launches containers (on YARN/Mesos) all by itself for each of ...

Read More »

Scala Syntax: 7 points

A few years back I dipped into some Scala as a hobby language. But, one aspect I found challenging was just getting my head around Scala syntax again. Some of it, yeah the basic stuff can be counter intuitive depending on your perspective. 1. Method / Function Definition Typing on the right rather than the left. Consider this simple function definition: def ...

Read More »

Dockerize your Scala application

Dockerizing a Scala application is pretty easy. The first concern is creating a fat jar. Now we all come from different backgrounds including maven/gradle and different plugins that handle this issue. If you use sbt the way to go is to use the sbt-assembly plugin. To use it we should add it to our project/plugins.sbt file. If the file does ...

Read More »

Kotlin and JUnit 5 @BeforeAll

Introduction In Kotlin, classes do not have static methods. A Java equivalent semantic can be provided to callers using the concept of a companion object though. This post will go into details of what it takes to support a JUnit 5 @BeforeAll and @AfterAll annotation which depend on the precense of a static methods in test classes. BeforeAll and AfterAll in Java Junit ...

Read More »

Testing Kotlin with Spock Part 1 – Object

The object keyword in Kotlin creates singleton in a very convenient way. It can be used for example as a state of an operation. Spock Framework is one of the most expressive and readable test framework available in the Java ecosystem. Let’s see how Kotlin object can be used in the Spock tests. What do we want to test? We ...

Read More »

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 »