Showing posts with label generalizing. Show all posts
Showing posts with label generalizing. Show all posts

Thursday, September 8, 2016

What We Can Learn About Generalization From Clojure

Clojure is a functional programming language based on LISP (List Programming) but built on top of Java runtime. There's a version built on JavaScript as well. A great resource for learning Clojure can be found here.

The link to the Clojure resource goes to the third part of the lessons because I want to highlight how that particular walkthrough goes from something specific, to something more general when it comes to the recursive function. It basically builds a map function from the ground up.

Hold that thought in mind and think about how software is built and how it can generally be improved over time. Software is "soft", it is malleable. It is meant to be changed so that we humans can take something that is so general "hardware" and plug in some instructions, in a language that we understand, for the generic computer to perform specific operations.

Generalizing functions/methods is the holy-grail of software. Big idea, I know. But here's why I say that - when we generalize functions they become reusable. When they are reusable, we don't have to keep rewriting them. If we never strove for re-use, everything could be hardware - hardcoded ICs that were task specific. And we wouldn't have very good technology at all. That was the state at one time. But since we have Software, we have re-use.

But, we can't generalize world. We wouldn't choose to use different languages if we could generalize indefinitely. Or the generalization would be so unwieldy that it would become a language of its own. But isn't that what a software language is? An ultimate generalization? Point is, there's a limit to generalization. It's situational most times and depends on the use cases.