Home » JVM Languages » Page 19

JVM Languages

Clojure web development – state of the art

It’s now more than a year that I’m getting familiar with Clojure and the more I dive into it, the more it becomes the language. Once you defeat the “parentheses fear”, everything else just makes the difference: tooling, community, good engineering practices. So it’s now time for me to convince others. In this post I’ll try to walktrough a simple ...

Read More »

Clojure (Prismatic) Schemas are Swagger

 Recently, I decided to include Swagger documentation to our time sheet application. Although Swagger provides tools to help clients integrate with your REST API the most powerful feature, in my opinion, is that it acts as “living documentation” for the API. Adding Swagger to my the application had a couple of pleasant side-effects: Idiomatic Clojure encourages the use of data ...

Read More »

Custom User types in GORM

Recently, I wanted to model a Merchant which like many things in a domain model had an Address. I thought it made sense that the Address was embedded inside the Merchant. Reasons: It had no lifecycle outside the Merchant. Merchant dies so should the address. It only ever belonged to one and only one Merchant So pretty obvious this was ...

Read More »

Dependency injection: syntax sugar over function composition

Quoting Dependency Injection Demystified: “Dependency Injection” is a 25-dollar term for a 5-cent concept. *James Shore, 22 Mar, 2006 Dependency injection, as much as it is important when writing testable, composable and well-structured applications, means nothing more than having objects with constructors. In this article I want to show you how dependency injection is basically just a syntax sugar that ...

Read More »

New Releases with a Better Kotlin API, Dataflow for Clojure and Faster Web Actors

Today we have released minor updates to Quasar, Pulsar and Comsat. The releases contain bug fixes, and some new features including an improved Kotlin API, dataflow variables for Clojure and fast implementations of Web Actors on top of Undertow and Netty. Elegant fibers and channel selection with Kotlin Quasar 0.7.0 introduced a natural Kotlin API (that feels like Erlang) for Quasar ...

Read More »

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 »