Home » JVM Languages » Scala

Scala

Scala Tuple performance

Tuple is very powerful construct in programming language, it allows to create sequence of finite elements. Elements in tuple can be of different type and very easy to declare like (“something”,1,new Date()) Nice thing about tuple is you have to only decided on data type of element not the name. Computer science has 2 hard problem : Cache invalidation and ...

Read More »

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 »

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 »

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 »

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 »

Kotlintest and property based testing

I was very happy to see that Kotlintest, a port of the excellent scalatest in Kotlin, supports property based testing. I was introduced to property based testing through the excellent “Functional programming in Scala” book. The idea behind property based testing is simple – the behavior of a program is described as a property and the testing framework generates random data to validate the ...

Read More »

Play and SBT basics

Previously we had an introduction to sbt, its default tasks and how to add extra tasks. Play comes with the sbt console. The SBT console is a development console based on sbt that allows you to manage a Play application’s complete development cycle. Let us create a play application using sbt and see the commands provided. sbt new playframework/play-scala-seed.g8 [warn] ...

Read More »