Jose Samonte wrote:Good day!
How hard is it to adapt existing architecture patterns such as, Layers Pattern, Ports and Adapters, Pipe-and-Filter, Publish-Subscribe, etc, to a functional design/approach?
Regards,
Joey
Hi Joey,
Layering is very natural to all the (good) application architectures, so FP isn't an exclusion here. Haskell programs tend to have the 3-layer architecture (interfaces/eDSLs ; business logic ; implementation), although I'm introducing more layers when it's needed.
The approaches I'm describing in the book, commit into 3-layer architecture. There are different ways to achieve it, but I mostly prefer Free monads.
I would say, many high-level patterns can be ported to some degree but implementation may be quite different. For example, the EulerHS framework (
https://github.com/graninas/euler-hs) that is built by me and my team has a Pub-Sub mechanism based on Free monads.
On the higher level of Software Design, FP doesn't differ from OOP that much but when it comes to implementation, FP may use something FP-specific. Or, there is always an escape hatch with imperative programming within an FP program.