OO design patterns vs FP idioms in Java 8
Esko Luontola
esko.luontola at gmail.com
Thu Oct 3 13:09:10 PDT 2013
Victor Nazarov wrote on 3.10.2013 12:08:
> I've always percept Visitor-pattern as an implementation of Algebraic Data
> Types in Java-like languages. Visitor-pattern is just an implementation of
> pattern-matching on ADT-constructors, and this is already present as
> language-level feature in all ML-like languages (including Haskell).
Me too. I've implemented an actor framework (http://jumi.fi/actors.html)
that relies on the Visitor pattern*; because Java doesn't have pattern
matching, the natural way of receiving messages is by implementing an
interface.
* Or maybe the Visitor pattern emerges from the use of Event Sourcing
and this actor framework; the system that uses those actors is based on
Event Sourcing, so in the UI layer visitors are needed to calculate the
system state from the events.
--
Esko Luontola
www.orfjackal.net
More information about the lambda-dev
mailing list