4 ms·
In functional, statically typed programmings languages, there is a pattern where business logic, including "actions", is encoded in types. This article [1] give
by sjakobi 10y ago
In functional, statically typed programmings languages, there is a pattern where business logic, including "actions", is encoded in types. This article [1] gives an example of filesystem manipulations that are encoded in a "FreeF" type.
When business rules are encoded in datatypes, it's easy to check that the encoding and the transformations are complete, and the logic can easily be mock-tested.
[1] http://degoes.net/articles/modern-fp http://degoes.net/articles/modern-fp
- AstralStorm 10y agoSome rules are extremely hard to encode as types or the result is extremely awkward. Or worse, performance suffers due to encoding. If it feels like translating into a foreign language, then it likely is that exotic or you are using a wrong language.