Home » JVM Languages » Scala » Page 25

Scala

Getting started with Scala and Scalatra – Part I

In this series of tutorials we’re going to look a bit closer at scalatra. Scalatra is a lightweight scala based micro-web framework, that can be used to create high performance websites and APIs. In this first tutorial we’ll just get started with the installation of scalatra and import our test project into Eclipse. SBT and giter8 Before you can get ...

Read More »

Real World Scala Test

There was recently a study about Scala vs. Java where some of Scala’s productivity, conciseness, and multi-core abilities were put to the test. The basic idea is take some semi-experienced programmers, teach them Scala for 4 weeks and see how they do coding up a contrived week-long multi-core example. The results basically did not support Scala’s claims of being radically ...

Read More »

Building ScalaFX 1.0 with Gradle 1.1

After becoming a little disenchanted with the SBT for Scala, I wanted an alternative that was more logical, simpler to understand and had a better user experience. After all, the whole point of a domain specific language is to make the writing of the script, formulae or grammar to be affordable to the users. A DSL must be comprehensible to ...

Read More »

Scala: Missing OO and FP bridge

Scala blends functional and object-oriented programming in many nice ways. You can use both FP an OO-like constructs whichever fits the current problem better. But there’s always room for improvement! Here’s one thing I think is missing (short version at the bottom). FP side It’s easy to convert a method to a function in Scala. For example, if you have ...

Read More »

Mahout and Scalding for poker collusion detection

When I’ve been reading a very bright book on Mahout, Mahout In Action (which is a great hands-in intro to machine learning, as well), one of the examples has caught my attention. Authors of the book where using well-known K-means clusterization algorithm for finding similar players on stackoverflow.com, where the criterion of similarity was the set of the authors of ...

Read More »

Custom Ordering Scala TreeMap

How do you get custom ordering in a Scala TreeMap? Well this puzzled me for a while. The answer lies in the world of implicits and receiver type converters. In a nut shell, a scala.collection.immutable.TreeMap is a SortedMap. If you look at the documentation for TreeMap, you will see it takes an Ordering[T] as an implicit argument. Normally when you ...

Read More »

Power with control: Scala control structures and abstractions

So ramping up with the Scala 101 series, I thought now is an appropriate juncture to introduce control structures in Scala. To a certain extent, working with the Scala language presents a vista wherein the developer is afforded much greater freedom than in many other environments, but therein lies a great many choices and a sense of responsibility. As such, ...

Read More »

ScaTDD: Casting an eye over three major Test frameworks in Scala

Testing has traditionally been the gateway process for Scala development at a number of Java shops looking to evolve their tech stack with minimal disruption or committment. This posts hopes to cover three of the main testing frameworks in the Scala landscape, ( Specs2, Scalatest and Scalacheck) with an example of the classic FizzBuzz test, for how they can be ...

Read More »

A crash course in Scala types

After many years of Java development, discovering Scala’s type system and related features was something of a departure for me. Suffice to say GADT wasn’t my first four letter utterance when learning about pattern matching on types, let alone what, when and how to use variance annotations and generalized type constraints. To kick things off, here’s a ‘small but powerful‘ ...

Read More »