Tell Above, and Ask Below: Hybridizing OO and Functional Design
michaelfeathers.typepad.com
michaelfeathers.typepad.com
Haskell98 defines if-then-else as a syntactic construct.
Then I realized that his argument makes lots of sense, so I reframed my thoughts on this.
My recent experience with Clojure has taught me that OO is very well suited for the few low level key abstractions, like Clojure's various reference types. Object orientation is great at maintaining an invariant, which is a key complexity management mechanism for dealing with mutation.
In a distributed system, you can view each node as a low-level mutable component of a bigger system. It's not the top of the entire system, it's the bottom of the communication and coordination system.
i don't follow, can you say more?
It is very nice if all you need is a simple function - and in that case sure you should use a library with functional API - but what if your needs are more complex? This is why I don't buy the "functional programming at the low level" idea.
The thing I would like to see is a way to mark a function as pure in imperative languages which would be checked by the compiler. That check would enforce that all variables are local and that no system function is called - but it could still call imperative code and also OO code that uses state manipulation - the only restriction would be that all that state is local (that is it is on the stack of the outer function that we mark as 'pure').