Code reuse is for me the holy grail of software. It is something we lost in large measure with the adoption of top-down development. And OO has only complicated the matter. For some time now I have advocated the use of factories and interfaces as a means of decoupling, but writing reusable code has continued to be a bit of a lost art. But then, I was a Java developer.
Having been exposed to Clojure, I've come to realize that a function is the smallest unit of reusable code, not a class. Simply moving logic from methods to functions (or to static methods, if you are still using Java) opens up a lot of possibilities. Mind, I still advocate the use of interfaces for method polymorphism, but limit method bodies to be little more than a call to a function or a property accessor. Doing this allows us to avoid class extensions and mind-numbing class hierarchies. The code becomes much clearer, defining new classes becomes much easier, and the need to refactor the code is greatly diminished. And writing reusable functions is much easier than writing reusable classes. from https://github.com/laforge49/aatree/wiki/Towards-Greater-Code-Reuse -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.