Member-only story
Functional Core & Imperative Shell Architecture — to isolate the domain logic
A Functional Programming Architecture equivalent to Hexagonal Architecture/Clean Architecture from OOP world
Nowadays, Functional Programming (FP) is more and more practiced on projects, as typically many functional languages have emerged in the last decade, such as F#, Elixir, Scala, Kotlin and especially javascript developers promote Typescript for strong typing while going all functional programming. The functional programming, a.k.a FP, paradigm is quite different from object-oriented, a.k.a OOP, but is not compatible with it. In fact, in FP we still require to consume objects and produce objects as output.
One of the concept of FP is having pure functions, that have no side effects. That is, for the same input, it generated the same output. Hence, a pure function is idempotent. But writing programs made exclusively from functions without side effects can’t be useful in the real world, because application, and even small programs have to interact with the real world somehow. A program read inputs from somewhere and generate outputs to be displayed or passed on somewhere else. Inevitably, for the program to be useful, that means some parts of our programs must be connected to some infrastructure to which they apply…