Saturday, November 3, 2012

What's good about ugly Java

Finally for today's link dump, a thought-provoking article from a guy at Twitter about why Java works so well for enterprise-scale applications: among other things, the many different options for a given object let you tune a massive application to suit your needs.  The result is harder code to understand, but that's because the subject itself is hard to understand.

There are other points in this article, which I need to reread to really get, but I think that this tunability is not a final answer to the question of code beauty.  Lately, I've been thinking in terms of annotations on code, and this is another place where an annotation would be appropriate.

As I'm rapidly prototyping a system, I'd simply instantiate some sort of default object; metadata for this object, however, would indicate that it could be tuned, perhaps by including additional callbacks, perhaps simply by selecting a particular set of tuning values - whatever.  As I needed to further tune my system after learning how it works, I'd annotate that call.  The annotation could be any arbitrary setup code, but here's the key: it would be invisible - a footnote.  Then I could have a reasonable overview version of the code that I could understand on an intuitive basis, without losing the detail that is required for the grungy version, and this, crucially, is why serious books have footnotes.  Seriously!  A straight down-the-list presentation of everything at once isn't conducive to a good understanding of complex ideas in any fields, so why should programming be any different?

Footnotes.  That's what a serious coding system needs.

No comments:

Post a Comment