

Observations on Functional Refactoring - locopati
http://blog.objectmentor.com/articles/2009/08/05/functional-refactoring-and-you-cant-get-there-from-here

======
mgreenbe
It's funny to see Haskell and TDD mentioned without QuickCheck
[http://www.haskell.org/haskellwiki/Introduction_to_QuickChec...](http://www.haskell.org/haskellwiki/Introduction_to_QuickCheck).

But, yes: referential transparency and functional (rather than sequential)
composition make for a different refactoring model, one where eta
expansion/contraction is the norm.

He does leave out the opportunity for more fluid refactorings: the
lenPreviousLines function could be refactored in a more conventional way
(changing the foldr of ((+).length) to a sum---which is a foldl---of a map,
for example).

~~~
michaelfeathers
I use QuickCheck, but it wasn't germane the point I was making so I didn't
mention it.

Actually, I did think of using sum when I was computing the length
differently, but I made another change and never got back to it. I agree, sum
would be better.

~~~
mgreenbe
I didn't mean to snipe: the "funny" I'm using is in a "cite original sources"
mode, which has little/nothing to do with the non-academic world. :)

