Home » Author Archives: Arthur Arts

Author Archives: Arthur Arts

Arthur Arts is an experienced Enterprise Java software engineer and hands-on Agile Coach and Scrum Master. He has a strong focus on agile engineering principles and practices and loves to share his knowledge and learn from others. He has his own company Coded Value, is a passionate photographer and writes for agilearts.nl.

Code Challenge “Vrolijke Framboos” Postmortem

Tuesday we had our second ever “Vrolijke Framboos” (Dutch for Happy Raspberry) Java code challenge at JDriven and it was a blast! This year’s challenge was to create a REST service client that would play a number guessing game with the server. After setting up a session you would guess a number and the server would respond with either “lower”, ...

Read More »

Scala Snippet: How to filter a list in Scala

In Scala, filtering and processing collections is easy and elegant. There are many filtermethods available, but the most used will probably the basic filter method. Here’s a code example of some filtering on my (ex)camera collection. The filter method will not only work on Lists, but on any Scala collection. object MyCameraCollection02 { class Camera(_brand: String, _model: String, _sensorType: String, ...

Read More »

Bruce Lee’s Top 5 Agile Coaching Tips

When I was a kid, I was a big Bruce Lee fan. I walked around the playground rubbing my nose with my thumb. When I had a piece of rope, I had to do my version of the nunchaku routine from Way of the Dragon and made cat-like noises. Looking back at Lee, I find it quite striking how many ...

Read More »

Scala Snippet: Object, Companion Object and Static Methods

If you are a Java developer moving to Scala, one notable difference in terminology that can cause confusion is the term ‘object’. In Java an object is always an instance of a class, created by calling a constructor. Object In Scala an object is used for defining a single instance of a class with the features you want. In practice ...

Read More »

Scala Snippet: Case Class vs plain ordinary Class

In Scala there exist the construct of a ‘case class’. According to Martin Odersky this supports you to write a “regular, non-encapsulated data structure”. It always seems to be associated with pattern matching. So when to use a case class and when to use a ‘plain’ class? I found this nice explanation stating: “Case classes can be seen as plain ...

Read More »

Alternating between Spray-servlet and Spray-can

On a server you may want to deploy your application as a war. How to build a war with spray-servlet. Locally it’s easiest to run without an application server. We include both the spray-servlet and spray-can dependencies: name := "sprayApiExample" version := "1.0" scalaVersion := "2.11.6" libraryDependencies ++= { val akkaV = "2.3.9" val sprayV = "1.3.3" Seq( "io.spray" %% ...

Read More »

Building a war with spray-servlet

We will use spray-servlet to build a war file of our API. So we can run it in a java app server. I assume we already have a working REST API. We will need a web.xml, under src/main/webapp/WEB-INF/: <?xml version="1.0"?> <web-app> <listener> <listener-class>spray.servlet.Initializer</listener-class> </listener> <servlet> <servlet-name>SprayConnectorServlet</servlet-name> <servlet-class>spray.servlet.Servlet30ConnectorServlet</servlet-class> <async-supported>true</async-supported> </servlet> <servlet-mapping> <servlet-name>SprayConnectorServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app> We need an sbt plugin to ...

Read More »

Building a rest api with spray

Building a rest api with akka and spray is easy. This is how I did it: SprayApiApp:                   import akka.actor.{ActorSystem, Props} import akka.io.IO import akka.pattern.ask import akka.util.Timeout import spray.can.Http import scala.concurrent.duration._ object SprayApiApp extends App { //we need an ActorSystem to host our application in implicit val system = ActorSystem("SprayApiApp") //create apiActor ...

Read More »

Chaining futures in scala

Suppose I want to make coffee. This involves 4 steps: 1a. grind coffee beans 1b. heat water 2. combine 3. filter All these steps take time, so they return a Future. This is our domain:     import scala.concurrent.{Await, Future} import scala.concurrent.ExecutionContext.Implicits.global //We need an executionContext to run futures import scala.concurrent.duration._ //This provides the "1 second" syntax class CoffeeBeans() class ...

Read More »

Introduction to Spring profiles


So many men, so many minds. When we are implementing software for different customers we sometimes need to handle various requirements for the same project. For example Customer A needs SAML authentication and customer B needs LDAP authentication. With Spring Profiles (available from Spring 3.1) we are able to provide a way to segregate parts of our implemented application configuration. ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns