Functional Validation in Kotlin

This post is the beginning of a series about functional software architecture in Kotlin. Its material originally comes from a collaboration between Active Group and Blume2000, where we consulted them on the development of their web shop. I wrote this post together with Benedikt Stemmildt, who was CTO at Blume2000 at the time.

This post is about data validation. We want to ensure that objects in our program are „valid,“ meaning they satisfy arbitrary consistency criteria without which our software won‘t function.

My colleague Marco Schneider already presented abstractions for this in Haskell in an earlier post.

The same ideas can also be transferred to Kotlin — with some compromises. In this post, we‘ll tackle the topic anew, specifically how we can help an object-oriented perspective using functional techniques. So it‘s not necessary to read the Haskell post. (We still warmly recommend the post, as it particularly describes the concept of Applicative, which is impractical in Kotlin.) However, basic Kotlin knowledge is assumed.

Read on...

Functional Programming in Practice: Validation with Applicative Functors

Our first article in the series „Functional Programming in Practice“ on the topic of data validation with applicative functors.

Read on...

Transducer: Composition, Abstraction, Performance

Transducer: Composition, Abstraction, Performance

Higher-order functions like map, fold, filter are indispensable in any functional program. With their flexibility, they are the tool of choice for operations on collections of all kinds. However, their scope of application is not limited to classic lists or vectors. In this article, we examine more fundamental properties of these operations and take a particular look at so-called transducers in the Clojure programming language.

Read on...

Build Systems with Haskell

Welcome to the New Year! We‘ll get started right with the first article of 2014 on a build system written in Haskell called shake.

Larger software projects (almost) all use a build system to automatically create a finished software product from source code. This includes, for example, compiling source files, linking object files, generating documentation, or assembling distribution archives.

This blog article provides an introduction to the shake build system, written in Haskell. This system has the advantage that dependencies between build artifacts can arise dynamically, i.e., while the build system is running. With make, probably the best-known build system, dependencies must be known before invoking the build system, which in practice often leads to limitations and problems.

We use shake at our company to compile our product Checkpad MED. Here shake plays to its full strengths, as an important component of the Checkpad infrastructure is code generation. Thanks to dynamic dependencies, it is possible to compile the program that generates the code, generate the code itself, and compile and link the generated code with a single invocation of the build system.

Neil Mitchell, the author of shake, developed a variant of the tool for use at Standard Chartered to efficiently compile really large software projects. Details on this as well as detailed information on shake‘s internal architecture can be found in this article.

Read on...