Skip to content

Colin Webb

ScalaTest and Twitter Futures

Scala has nice abstractions for asynchronous code. However, writing tests for that code sometimes results in an ugly, unreadable mess. Fortunately, ScalaTest has built-in support for testing Futures, in addition to utilities for other types of asynchronous testing, such as polling and test-probes.

Mock Responses and Iterate

'Agile' may now be an overloaded term abused by all kinds of people, but the original manifesto is actually still quite relevant. The second point is:

Working software over comprehensive documentation

This is useful to embrace in many circumstances, and can be expanded to:

You should intially favour building software over documenting it. Comprehensive documentation can come later.

#Code2014

As the end of the year approaches, Twitter has a hash-tag named #Code2014 that encourages people to tweet which programming languages they've been using over the last 12 months.

Monoids

In abstract algebra, a branch of mathematics, a monoid is an algebraic structure with a single associative binary operation and an identity element. Monoids are studied in semigroup theory as they are semigroups with identity.

Wikipedia has the above definition of a Monoid. This blog post will desconstruct that definition to simply describe what a monoid is, and why you would want to use one.

Aggregation Services in Node.js

My previous blog post talked about building Aggregation Services using Play-JSON. In it, I mentioned that Aggregation Services using JavaScript might be quite nice. As JSON is native to JavaScript, you might expect manipulating JSON in JavaScript to be incredibly simple. And you would be correct!

Aggregation Services using Play JSON

Aggregation services (sometimes known as Composite or Hydration services) are useful when working in SOA. In SOA, services are responsible for discrete objects and collections, yet still often need to reference other object or collections controlled by another service. This is done via referencing Ids. In order to display something useful to the user it is necessary to lookup data from multiple sources and aggregate them together.

Akka Camel and ActiveMQ

I've been using Akka Camel and ActiveMQ recently, as part of a delayed worker-queue system. Given the lack of good googleable information about combining the two, I thought it would be useful if I explained briefly how to get Akka Camel and ActiveMQ to work together in the form of a quick example.

Testing in Scala with DSLs

Using a DSL to write a test can prove to be useful, especially when there are lots of prerequisites, or the problem is complex. Having a test that is incredibly readable reduces complexity overhead and aids reader comprehension. Any tests that require the reader to retain a mental map could benefit from a DSL.

Better Assertions with ScalaTest

Scala has three different frameworks for writing unit tests, JUnit, Specs2 and ScalaTest. I have mainly been using ScalaTest since I started to learn Scala about four months ago. One of the areas I have been concentrating on is how to write good assertions. Specifically, ones that yield easily diagnosable error messages when they fail.