Thursday, August 03, 2006

commentary on kingdom of nouns

Here's a link that uses the well-known noun-verb metaphor of Computer Science to talk about the Kingdom of Nouns: Java. I say that this metaphor is well known because I seem to recall actually learning about OO design methedologies (UML?) that advise a programmer to identify the nouns of a problem, then figure out the verbs by reasoning about how the nouns collaborate to perform the work.

The simple truth is that ideas about software design don't fall out of the sky; people invent them for a reason. OOP caught on because the ability to bundle data and methods into a single, easily reusable and extendable unit does wonders for promoting code modularity. You can modify your class all you want to, and I can modify mine all I want to, but as long as each of our classes only interact in public, well-defined ways, the code won't break. A class is the logical progression of the concept of an Abstract Data Type, and typing is not evil.

On the other hand, when you aren't "architecting", and just want to get stuff DONE for Bob's sake, all this OO apparatus is beside the point because you care about the verbs, not the nouns. (I'll leave aside the point that anyone could implement a simple one-object facade to make the common use cases of a complicated object hierarchy easier). Hence the group of scripting languages for the JVM. Take your pick: Jython, Groovy, BeanShell, Rhino, others...again, these languages would not have come about unless Java was better optimized for programming in the small and simple.

I like how this article also points to the opposite extreme: what he seems to describe is the (very real and scary) Unlambda language, in which all you do is construct and apply functions. Variables? Who needs 'em!

The practical upshot here is that a language that isn't multi-paradigmatic also isn't best for all situations. That is, a language should be great at working with both nouns and verbs. Or you could just use whatever language is most appropriate for a given situation. If the languages can interoperate on a common platform (see Parrot or JVM or .Net), then even better.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.