Table of Contents
Fetching ...

Bidirectionalization For The Common People

Juraj Dončević, Mario Brčić, Danijel Mlinarić

TL;DR

This paper addresses making bidirectional transformations (BX) practical beyond DSLs by embedding BX in C# via the Bifrons library and validating it with a dedicated testing framework. It introduces monad-enriched simple symmetric lenses and a testing approach that relies on unit tests to verify the round-trip governed behavior, using the $Result$ monad to represent success or error. Canonizers are used to translate between canonical C# objects and external data formats, enabling realistic deployment and a case study of synchronizing relational data between PostgreSQL and MySQL. The contributions demonstrate a practical, language-integrated BX path that reduces cognitive load, keeps within the .NET ecosystem, and points to BX applications beyond data synchronization.

Abstract

This paper presents an innovative approach to applying bidirectional transformations (BX) in practice. To introduce BX to a wider audience of technologists, engineers, and researchers, we have chosen to use C# to develop Bifrons - a library of BX lenses that replaces domain-specific programming languages (DSL) in practical use. The proposed approach simplifies the implementation effort for two-way transformations by using simple symmetric lenses as the initial design pattern. It ensures correctness within reason by providing a simple lens-testing framework. We demonstrate the usability of BX lenses in a realistic scenario by using Bifrons to perform a case study experiment synchronizing data from two structurally and technologically heterogeneous databases.

Bidirectionalization For The Common People

TL;DR

This paper addresses making bidirectional transformations (BX) practical beyond DSLs by embedding BX in C# via the Bifrons library and validating it with a dedicated testing framework. It introduces monad-enriched simple symmetric lenses and a testing approach that relies on unit tests to verify the round-trip governed behavior, using the monad to represent success or error. Canonizers are used to translate between canonical C# objects and external data formats, enabling realistic deployment and a case study of synchronizing relational data between PostgreSQL and MySQL. The contributions demonstrate a practical, language-integrated BX path that reduces cognitive load, keeps within the .NET ecosystem, and points to BX applications beyond data synchronization.

Abstract

This paper presents an innovative approach to applying bidirectional transformations (BX) in practice. To introduce BX to a wider audience of technologists, engineers, and researchers, we have chosen to use C# to develop Bifrons - a library of BX lenses that replaces domain-specific programming languages (DSL) in practical use. The proposed approach simplifies the implementation effort for two-way transformations by using simple symmetric lenses as the initial design pattern. It ensures correctness within reason by providing a simple lens-testing framework. We demonstrate the usability of BX lenses in a realistic scenario by using Bifrons to perform a case study experiment synchronizing data from two structurally and technologically heterogeneous databases.

Paper Structure

This paper contains 13 sections, 9 equations, 12 figures.

Figures (12)

  • Figure 1: Basic lens
  • Figure 2: Simple symmetric lens
  • Figure 3: Relational metamodel for the Bifrons relational structural lenses
  • Figure 4: Relational structural BX lenses in Bifrons
  • Figure 5: Relational data model in Bifrons (referenced relational model elements are omitted)
  • ...and 7 more figures

Theorems & Definitions (4)

  • Definition 1: Basic lens
  • Definition 2: Simple symmetric lens
  • Definition 3
  • Definition 4: Monad-enriched simple symmetric lens