Campbell Ritchie wrote:How does designing a functional application differ from designing an objecct‑oriented one?
This is actually a great question, and I'm quite interested in showing the difference. This is why I have a talk "Functional Declarative Design: a counterpart to Object-Oriented Design". It was a talk for Manning / Twitch, and I hope they'll move it to YouTube soon. For now it's available by this link:
https://www.twitch.tv/videos/1150160792
You can check out my slides:
https://docs.google.com/presentation/d/1F2euJMIrnGe5Ii53a6C19YrpYkhsbl1chXewqWQAXuY/edit?usp=sharing
The question is too broad, so key differences:
- Pure/impure layering. We don't put that much effort in keeping our OOP applications separated into these two layers. In FP, we do this all the time
- eDSLs in FP are much more preferred than in OOP (although everything can be seen as a kind of eDSL)
- FP applications can have many different architectures although the 3-layer architecture is quite popular. We have our own tools for it: Service Handle
pattern, Free monads, Final Tagless/mtl, ReaderT pattern and some others
- There are OOP interfaces in
Java and C#, and I consider Free monads to be the best analog to OOP interfaces. Free monads are functional interfaces having additional properties (eg you can build good monadic languages and frameworks with Free monads)
You'll find more interesting points in my talk.