Home » JVM Languages » Scala (page 5)

Scala

Scala notes – Futures – 3 (Combinators and Async)

In the previous parts of this post, we discussed about Futures and Promises. In this last part, we’ll compose Futures using its powerful combinators. Composing Futures : In the first post, we saw how to extract a value from Future using onComplete, foreach and in testcases using Await.result. Extracting a value from a single Future is good but many a ...

Read More »

Unit vs Integration Akka Testing

This is the sixth post in the series about integrating sync clients with async systems (1, 2, 3, 4, 5). Here we’ll see how to test Akka actors with different testing styles. Unit vs Integration Testing Nowadays everybody agrees with the famous testing pyramid:           Harder to achieve is an agreement on what integration, unit, functional ...

Read More »

Spark Streaming Testing with Scala Example

Spark Streaming Testing How do you create and automate tests of Spark Streaming applications?  In this post, we’ll show an example of one way in Scala.  This post is heavy on code examples and has the added bonus of using a code coverage plugin. Are the tests in this tutorial examples unit tests?  Or, are they integration tests?  Functional tests? ...

Read More »

Scala notes – Futures – 2 (Promises)

In the last post, we saw how to extract values from the Future upon onComplete and their counterparts – onSuccess and onFailure. We also saw how to use Await.result in Testcases to block and get the value from Future. In this post, we’ll discuss briefly about the relationship between a Promise and a Future. Promise The concepts Promise and a ...

Read More »

Coordination in Akka

This is the fifth post in the series about integrating sync clients with async systems (1, 2, 3, 4). Here we’ll see how to manage the actor’s lifecycle, so our service can use the available resources efficiently. Lifecycle Actors, threads, objects, resources… All of them have different states during their lifetime. Some of those states are internal and they shape ...

Read More »

Scala Notes – Futures – 1

Almost all modern programming languages have a Future-Promise idiom for concurrent programming. I don’t intend to bore you with why we need higher level of concurrency abstractions. Instead, in this post, we’ll cut to the chase and discuss only about Scala’s approach to Futures. A scala.concurrent.Future is a representation of a value that is yet to be realized. This value ...

Read More »

Apache Spark Machine Learning Example with Scala

In this Apache Spark Machine Learning example, Spark MLlib will be introduced and Scala source code reviewed.  This post and accompanying screencast videos will demonstrate a custom Spark MLlib Spark driver application.  Then, the Spark MLLib Scala source code will be examined.  There will be many topics shown and explained, but first, let’s describe a few machine learning concepts. Machine ...

Read More »

Akka Notes – Finite State Machines – 2

In the first part of notes on Akka FSM, we saw the basics of Akka FSM and the outline of the Coffee vending machine that we planned to build – the structure of the Actor and a list of messages we pass to the Actor. In this second and final part, we will go ahead and implement each of these ...

Read More »

Akka Notes – Finite State Machines – 1

I recently had the opportunity to play with Akka FSM at work for some really interesting use-case. The API (in fact, the DSL) is pretty awesome and the entire experience was amazing. Here’s my attempt to log my notes on building a Finite State Machine using Akka FSM. As an example, we’ll walk through the steps of building an (limited) ...

Read More »