Member-only story
Entities And Models Are Not APIs
In APIs, we want access to super-classes, as that is how we define an API by having unfettered access. But, when defining data instead, we want to LIMIT access.
That is where the first step towards Functional Programming comes in; as we will use code generation to produce a sealed class construct to place entities and models into.
And we use this OOP code generation to create a sealed class which is just a fancy singleton for how we define the data is meant to be sub-classed and only just used as a singleton.
My Apologies Ahead Of Time, What Is Algebraic Data Types And Category Theory
I am not currently and Mathematics or Computer Science major, so I may miss-use certain terms or over simplify them.
The types we use in OOP and FP and even database schemas have their mathematic foundation in Category Theory. Algebraic Data Types are also part of that theory where the Data Type is basically treated the same way algebraic equations are in that we can add them, subtract them, multiply them, and divide theme.
The operators that allow us to do this have a group name of Monads.
So what do we get by using Algebraic Data Types on Data classes, say instead of Equatable? Well, let me show you the…