I'd like to get some feedback from the Racket group regarding Object
Oriented vs Functional styles. I know this can be a bit of a quagmire, so
apologies if it's not appropriate to post it here. I just thought I'm
likely to get some of the more thoughtful replies from this group.
I've read the paper here:
http://www.cs.rochester.edu/~cding/Teaching/254Fall2001/Assignments/tr98-299.pdf
which
outlines the central problem as having to choose between extensible
variants (OO) and extensible tools (functional). The paper proposes the
extensible visitor pattern as a solution, and ultimately rests in the OO
camp. The next paper: http://www.ccs.neu.edu/racket/pubs/icfp98-ff.pdf goes
a step further by showing how Racket specific features such as Units and
Mixins can eliminate the need for the extensible visitor design pattern,
and again, lands firmly in the OO camp.
In contrast, I've been playing a lot with Clojure and reading Rich Hickey (
http://www.infoq.com/presentations/Value-Values and
http://www.infoq.com/presentations/Simple-Made-Easy) and he proposes the
opposite approach: OO's time has come, and that through powerful
functional languages you can achieve encapsulation, polymorphism and
extensibility in a simpler manner without the complexity of OO techniques.
I'm curious as to the opinion of this community regarding Rich Hickey's
stance on applying immutable values and pure functions to nearly every
programming problem.
Regarding the first two papers discussing Object Oriented and Functional
approaches to reuse, I'm wondering:
1.) Do generic functions (multiple dispatch) in a language not empower the
functional arguments in the first two papers by Matthias and Matthew (and
others)? If I can add new functions with the same name that dispatch on
new variants as they are added, is this not a simple solution to the
extensibility problem in a functional style? Does this not allow for reuse
of both the original components *and* the existing clients?
2.) Does there exist an obvious class of problems that are better suited to
an object oriented design vs functional and vice-versa, or is the power of
such languages as racket reducing the OO vs Functional debate to a
religious war, whereby both methods achieve reuse and it's just a matter of
preference?
Thanks a lot.
--
Talk to you soon,
Scott Klarenbach
PointyHat Software Corp.
www.pointyhat.ca
p 604-568-4280
e scott at pointyhat.ca
200-1575 W. Georgia
Vancouver, BC V6G2V3
_______________________________________
To iterate is human; to recur, divine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130620/5c2aba08/attachment.html>