While writing up my Clojure Enigma machine I was struck by a habitual fear. A fear honed by experience. The fear that my code was too exposed.
Years of Java development have taught me that encapsulation is important. Yet I was just casually throwing functions into my namespace for all the world to use. I was troubled. Especially since one of my key early learnings in Javascript had been about how to use closures to create modules that limit scope.
I had a think. I talked to some other Clojurians. I decided that maybe I was worrying without cause. Access levels are useful in Java, but I often feel like I'm trying to protect my classes' state, but I want to re-use other classes' functionality. But this conflict simply didn't exist in my Clojure program. It was functional! It had no state!
No comments:
Post a Comment