rockymadden / stringmetric

:dart: String metrics and phonetic algorithms for Scala (e.g. Dice/Sorensen, Hamming, Jaccard, Jaro, Jaro-Winkler, Levenshtein, Metaphone, N-Gram, NYSIIS, Overlap, Ratcliff/Obershelp, Refined NYSIIS, Refined Soundex, Soundex, Weighted Levenshtein).
https://rockymadden.com/stringmetric/
486 stars 81 forks source link

Favor functional composition over trait decoration. #17

Closed rockymadden closed 10 years ago

ryanlecompte commented 10 years ago

Can you give a small example of what you are aiming for here? Just curious. :-)

rockymadden commented 10 years ago

Sure, you can see a rough idea on this other project: https://github.com/rockymadden/delimited#transform-usage

There are a lot of areas in this older library that could be tightened up with functional programming concepts, this being one of them. With functional composition and higher order functions, rather than decorations, algorithms and metrics could be objects rather than classes, devs could provide their own rather than waiting on me to do something, etc. Hope that makes sense. More information, though not directly applicable: http://akisaarinen.fi/blog/2012/11/24/mismatch-between-oo-and-function-composition/

If it isn't desirable, let me know. I've just learned a lot about functional programming since developing this library and a lot of old cruft/OO ways of approaching problems I see now.

ryanlecompte commented 10 years ago

Awesome, I think that's a wonderful approach and I have done similar things myself in the past. Thanks!

On Dec 27, 2013, at 9:24 AM, Rocky Madden notifications@github.com wrote:

Sure, you can see a rough idea on this other project: https://github.com/rockymadden/delimited#transform-usage

There are a lot of areas in this older library that could be tightened up with functional programming concepts, this being one of them. With functional composition and higher order functions, rather than decorations, algorithms and metrics could be objects rather than classes, devs could provide their own rather than waiting on me to do something, etc. Hope that makes sense. More information, though not directly applicable: http://akisaarinen.fi/blog/2012/11/24/mismatch-between-oo-and-function-composition/

If it isn't desirable, let me know. I've just learned a lot about functional programming since developing this library and a lot of old cruft/OO ways of approaching problems I see now.

— Reply to this email directly or view it on GitHub.