Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #25436

Re: OO Design Patterns vs FP

From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: OO Design Patterns vs FP
Date 2013-10-02 15:55 -0400
Organization A noiseless patient Spider
Message-ID <l2htmi$tc3$1@dont-email.me> (permalink)
References <l2gi7f$3gc$1@news.albasani.net> <l2he49$rka$1@dont-email.me> <l2hh3u$be$1@news.albasani.net> <l2hl8f$7p4$1@dont-email.me> <l2hs8j$mg2$1@news.albasani.net>

Show all headers | View raw


On 10/02/2013 03:31 PM, Sebastian wrote:

> Here's a useful quote from Neal Ford's article series on IBM
> developerworks:
>
> <quote>
> In the functional-programming world, traditional design patterns
> generally manifest in one of three ways:
> 1. The pattern is absorbed by the language.
> 2. The pattern solution still exists in the functional paradigm, but the
> implementation details differ.
> 3. The solution is implemented using capabilities other languages or
> paradigms lack. (For example, many solutions that use metaprogramming
> are clean and elegant — and they're not possible in Java.)
> </quote>
>
> My reading so far could be summarized like this:
>
> - Strategy
>    -- take functions (Java 8 lambdas) that implement a strategy
>    -- provide functions to choose from
>
> - Template and Factory Method
>    -- these patterns also relate to supplying concrete behavior
>    -- abstract template methods may become simple members (lambdas),
> concrete subclasses disappear
>
> - Command
>    -- disappears, because object wrapper not needed for portable
> functionality in Java 8
>
> - Chain of Responsibility and Decorator
>    -- composition of (partial) functions
>
> - Adaptor
>    -- adaptor classes can be conveniently replaced by (composable) lambdas
>
> - Visitor
>    - more complex, no direct correspondence
>    - special case for streams: reduce (decouple traversal of stream from
> operation on stream elements)
>
>
> I’d welcome any comments, additional examples of correspondences etc.
>
A bit more useful as a starting point for discussion. Thanks. :)

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

OO Design Patterns vs FP Sebastian <news@seyweiler.dyndns.org> - 2013-10-02 09:33 +0200
  Re: OO Design Patterns vs FP Jeff Higgins <jeff@invalid.invalid> - 2013-10-02 11:29 -0400
    Re: OO Design Patterns vs FP Sebastian <news@seyweiler.dyndns.org> - 2013-10-02 18:21 +0200
      Re: OO Design Patterns vs FP Jeff Higgins <jeff@invalid.invalid> - 2013-10-02 13:31 -0400
        Re: OO Design Patterns vs FP Jeff Higgins <jeff@invalid.invalid> - 2013-10-02 15:16 -0400
        Re: OO Design Patterns vs FP Sebastian <news@seyweiler.dyndns.org> - 2013-10-02 21:31 +0200
          Re: OO Design Patterns vs FP Jeff Higgins <jeff@invalid.invalid> - 2013-10-02 15:55 -0400

csiph-web