Home » JVM Languages » Page 20

JVM Languages

Refactoring with Kleisli Composition

For quite awhile we have been maintaining an application that processes XML and JSON data. Usually the maintenance consists of fixing defects and adding minor features, but sometimes it requires refactoring old code. Consider, for example, a function that extracts an XML node by path: import scala.xml.{Node => XmlNode} def getByPath(path: List[String], root: XmlNode): Option[XmlNode] = path match { case ...

Read More »

Divided We Win: an event sourcing / CQRS prospective on write and read models separation. Commands and Events.

In today’s post we are going to unveil some very interesting (in my opinion) architecture styles: event sourcing and command query responsibility segregation (CQRS). Essentially, in both of them events are in the heart of the system design and reflect any changes of the state which are happening. It is quite different from the traditional CRUD architecture where usually only ...

Read More »

Easy validation in Scala using Scalaz, Readers and ValidationNel

I’m working on a new book for Packt which shows how you can use various Scala frameworks to create REST services. For this book I’m looking at the following list of frameworks: Finch, Unfiltered, Scalatra, Spray and Akka-HTTP (reactive streams). While writing the chapters on Finch and Unfiltered I really liked the way these two frameworks handled validation. They both ...

Read More »

How to build a symbol solver for Java, in Clojure

Last week we have seen how to build models of Java code from source and JAR files. Now we want to be able to solve symbols: in practice we want to link the symbol references in our source code to symbol declarations either in Java source files or jar files. Symbol references and symbol declarations As first thing we have ...

Read More »

Making Spring Batch Groovy


Here at Keyhole, we are very fond of Spring Batch. In many Java Enterprise environments, there is still a big need for automating moving data around. Spring Batch gives us a great head start on creating these batch processes. Note: if you’re in the area on Wednesday night (8/5/15), check out Keyhole Managing Partner David Pitt’s Spring Batch presentation at the ...

Read More »

Why build your own type system?

In Ceylon 1.2 we’ve factored out the type system of Ceylon as an independent module, with minimal dependencies and a clean API. The ceylon-model project incorporates: an extensible object-oriented model of the type system in Ceylon, algorithms for reasoning about types at compile time—or even at runtime in a system with reified generics—and a framework for model loading, that is, ...

Read More »

A little more about type functions

My previous post about type functions generated some interesting discussion, here, and on reddit. Therefore, I think it’s worth tying up several loose ends from the earlier post. So here’s a collection of further observations about type functions. Warning: this post addresses some very technical details of how we’ve incorporated type functions into Ceylon’s type system. Don’t even bother continuing ...

Read More »

Constructors in Ceylon

Since the earliest versions of Ceylon, we’ve supported a streamlined syntax for class initialization where the parameters of a class are listed right after the class name, and initialization logic goes directly in the body of the class. class Color(shared Integer rgba) { assert (0 <= rgba <= #FFFFFFFF); function encodedValue(Integer slot) => rgba.rightLogicalShift(8*slot).and(#FF); shared Integer alpha => encodedValue(3); shared ...

Read More »