Skip to content

Comment on Simple Is Not Small

Comments

"In Clojure this is fairly straightforward"

Somehow when things get complex, I could never find fully functional style to be more understandable than imperative

Maybe part of it is that fully functional notation necessarily preserves certain properties of the computation, while imperative style doesn't have to. For a complex piece of code, all of the hairiness is manifest in a functional style, but can be made implicit in an imperative style. So there's an economy to the imperative approach as things get complex, but in a sense we're just laundering the complexity from understanding the machinations of the code to understanding the correctness of the code.

Hence, objects; keep alternating between functional (stateless) and imperative (stateful) as you ascend the abstraction tower, so that the hairiness does not leak between layers and hence accumulate.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.