Data Modeling with Sums and Products

submited by
Style Pass
2024-11-26 14:30:07

Data Modeling is often an underappreciated aspect of software architecture, yet it plays a crucial role in achieving not only functional but also usability and maintainability goals. Poor data models and poorly integrated data models can greatly hinder architecture work. Consequently, data modeling — particularly of a project‘s core information — should be considered a fundamental responsibility of software architecture.

This article examines two basic tools for good data models: sums and products. These concepts are known under a variety of names, depending on context, community, and programming language. Products are also known as records, structs, data classes, tuples, or and data, and sums are known as discriminated union, disjoint union, union, mixed data, and or data.

Sums and products have their roots in algebraic data types, which are well known from functional programming languages like Haskell or OCaml. However, the underlying concept is independent from a particular programming language. In many years of experience in software architecture and development, we have used this concept as a valuable tool for all kinds of data modeling tasks, in various programming languages and contexts.

Leave a Comment