Home » JVM Languages » Scala

Scala

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 »

SBT basics

Sbt is the de facto build tool in the Scala community. Being used to other build tools you will be familiar with the commands clean – Deletes files produced by the build, such as generated sources, compiled classes, and task caches. compile – Compiles sources test – Executes all tests package – Produces the main artifact, such as a binary ...

Read More »

Use JSON with Play and Scala

Once getting your hands into typing scala code using play, the first thing that comes to mind is JSON. Without doubt JSON is one of the most basic components of web applications. Rest apis use json, your angular app has to consume json and the list goes on. If you are lazy like me, you expect that it is sufficient ...

Read More »

SQL Data Access in Play using Scala

Today’s modern application frameworks come with apromise of easy sql data access. There is no wonder why we have so many frameworks that make it easier to issue queries and handle transactions. SQL is the lingua franca of most applications when it comes to databases. Play comes with the JDBC plugin. We encountered the JDBC plugin previously in order to ...

Read More »