Learn More, Know Less

|

I read Refactoring. Thought I understood it. Liked it, even. Wordy in place, but well worth reading.

Now I'm working with XSLT. I want the transformations to be fast, of course, which means I need to learn more about functional programming (because, though you'd never really know at first blush, XSLT is a full-on language).

So in hindsight, Extract method, replace temp with query... this is all about referential transparency, isn't it? The concepts are really inextricably linked, very obviously for those refactorings and less obviously but no less intrinsically to many other refactorings.

But referential transparency is all about about pure-functional programming, removing side effects. And side effects are like globals (or singletons, and Lord do I hate singletons) but isn't an object method kind of a like a function with the object properties as globals? How's it different? Is it?

If maintainable code is refactorable, and refactorable code is functional, and objects are inherently tied up with side-effects, and side-effects are non-trivially incompatible with functional programming, how the hell are we not all globally and intrinsically screwed?

Pages