structible

Standardize and ease conversions between different, environment-based representations of the same type.

Motivation

Applications nowadays typically integrate with a variety of environments (and thus their type systems) such as messaging formats, configuration (files) or databases.

While these environments usually support common types (e.g. primitive types, regular classes) out of the box, support for more refined types (e.g. timestamps or domain specific value classes) varies greatly or is lacking completely.

As a consequence, you end up writing lots of one-to-one integration code mapping between the two.

Overview

structible attempts to address this issue as follows:

  • Instead of each library providing its own way of integrating refined types, provide a common way to specify type conversions and provide a small derivation module for each library
  • Provide a DSL for common constraints to be checked when mapping a common type to a refined one (e.g. c >= 0, c matches <regex>)
  • Generate error messages to avoid hand-crafted (and thus) error-prone ones (typos, refactoring, …)
The source code for this page can be found here.