ObjectFunctionalImplementation
Last edit October 16, 2010
ObjectFunctionalImplementation
belongs both in
ObjectFunctionalPatterns
and in
FunctionalProgramming
. Both these topics seem to have been around for a long time without being very much connected together. This can be changed if the
ObjectFunctionalPatterns
are used to generate implementations in one or more programming languages. This would generate general purpose tools.
Some patterns have already been described, including some example code.
FunctionalPatternSystemForObjectOrientedDesign
gives a full set of patterns with some code examples in
EiffelLanguage
.
In
CeePlusPlus
there are several resources which can be used to cover parts of the same material
FunctoidsInCpp
(which makes it possible to have a
LazyObject
in C++)
ModernCeePlusPlusDesign
BoostLibraries
I am currently attempting to build a set of programs in
CeePlusPlus
to implement the patterns of
FunctionalPatternSystemForObjectOrientedDesign
. For this I am making a lot of use of
FunctoidsInCpp
and some use of
PromotionTraits
.
As part of that I am reimplementing the
EiffelLanguage
code examples kindly supplied to me by
ThomasKuehne
, using
SmartEiffel
.
Things so far tackled in both C++ and Eiffel now include:
FunctionObject
(on this wiki called
FunctorObject
)
ValueObject
LazyObject
(in fact implemented as a
StreamObject
)
TransfoldPattern
(including the
TransposeFunction
,
MapFunction
and
FoldFunction
)
TranslatorPattern
I now have this working in C++, optionally using
FunctoidsInCpp
.
I also have another version which uses the
AcyclicVisitor
described in
ModernCeePlusPlusDesign
.
also a fully functional approach which combines
AcyclicVisitor
with
FunctoidsInCpp
.
I was not previously a user of
EiffelLanguage
so I am learning that as I go along. The version in
SmartEiffel
is not the same as the one used by
ThomasKuehne
for his examples in the book, so his examples need some modification.
--
JohnFletcher
See also
ObserverPatternInCeePlusPlus
.
PatternImplementationDiscussion
What got missed:
GenericFunction
,
GenericFunctionObject
which need to be mentioned here. There is some discussion on
GenericFunction
of implementation.
FunctoidsInCpp
provides a means of implementation of some of the (parameter variation) in
CeePlusPlus
, but not of variation on specific values. --
JohnFletcher
See also
ScalaLanguage
and
DeprecatingTheObserverPattern
.
CategoryObjectFunctionalPatterns
CategoryFunctionalProgramming
CategoryEiffel
CategoryCpp
CategoryMultiparadigm