"A Functional Pattern System For Object-Oriented Design" by ThomasKuehne
Published by Verlag Dr. Kovac, Hamburg, Germany, in 1999. 328 pages.
(Please note that although the ISBN link does work, the book is not available through amazon.com.)
Describes how functional and object-oriented programming can be used
together by giving some patterns for doing functional programming
with an OO language.
Example implementations are in EiffelLanguage
(While the commercial version of the book is Out of Print, a pdf version can be had from the author's home page)
If interested it can be ordered, or read online, see http://www.mm.informatik.tu-darmstadt.de/~kuehne/fps/
Design patterns inspired by FunctionalProgramming
concepts can advance
This thesis promotes the idea that concepts from the world of FunctionalProgramming
can be captured with design pattern descriptions. These can then be used to benefit from functional programming concepts with ordinary
object-oriented languages. The functional patterns are evaluated for their impact on language design and a new approach to a dual-paradigm language is presented.
Abstract, and How to Order.
The patterns are:
- FunctorObject (called FunctionObject in ThomasKuehnes thesis but different from the FunctionObject described on this wiki)
- Black-box behavior parameterization
- Evaluation-by-need semantics (LazyEvaluation) and CallByNeedSemantics
- Combining InternalIteration and ExternalIteration
- Abandoning null references
- HomomorphicMapping with multi-dispatch functions (ExternalPolymorphism)
I am fascinated by the efficiency, elegance and beauty of functional programs -- my favorite language are Lisp and Haskell, although most systems I am involved with are Java architectures.
I'll have to take your patterns out for a spin before I can comment more but I am definitely interested,
Some People prefer the term Do Nothing or Empty Behavior Object to NullObject
as it eliminates the usual arguments over void, nil, or null.
I wonder what Thomas would think of the PythonLanguage
. It seems to support most of this stuff pretty directly. -- PhilGoodwin
Python's support is nice, but it is a long stretch to a full blown multi-paradigm language. Still, that guy is right (see below). -- ThomasKuehne
Python supports some functional programming concepts. See "Lambda forms" in the Python tutorial . -- A guy
Good old Smalltalk supports many more functional programming concepts than Python, including full closures and continuations. -- MarkusKohler?
There are also examples of OO-FP languages. See OHaskell on page FpVsOo
There are several examples of OO-FP languages. See NiceLanguage
(multi methods) and ScalaLanguage
For some attempts to implement the patterns in CeePlusPlus
and also implement EiffelLanguage
examples using SmartEiffel
And here I thought this was the exact opposite, a guide on implementing objects in functional languages
. But then again, that's so simple, one could hardly write a paper, let alone a book about that.
Please read ParkingTicket.
See also PatternImplementationDiscussion
CategoryObjectFunctionalPatterns CategoryBook CategoryEiffel CategoryFunctionalProgramming