Skip to main content

Closures: Making Java a More Expressive Language?

Posted by chet on December 15, 2006 at 6:48 AM PST

I went to a
talk by Neal Gafter
at JavaPolis on Neal's proposal
for closures in Java
saw some happy code. The syntax that Neal is currently proposing can sometimes
result in a ":)", which, as Sun's John Rose noted, is a smiley in the

Let's call this emoticode: the ability for code to express
itself emotionally.

Completely ignoring any relevant discussion about syntax options, semantics, or
even closures themselves, I just wanted to voice my support for
emoticode. Far too long have we labored with languages which have no
inherent emotion. The characters just sit there passively in our editor,
staring dully back at us, having nothing more to say than what the compiler
tells them they can. Now, through new language syntax, we can see whole new
language patterns developing where code can be much more expressive. Code can
smile at us, or frown, or wink, or laugh, or do any of the many, wonderful
things that emoticons can do in the trite emails and IM messages that we
receive from friends.

Finally, we can finally have a meaningful relationship with the code we write.

Perhaps we need more language features that specifically target
emoticode. Maybe we can flag
bug patterns
through emoticode syntax. Or we can encourage good
programming practice through happy expressions. Beginning programmers
may fall into patterns that use emoticode that laughs at their
developer; this gentle poking fun can help these students learn better coding
practices while encouraging them to develop a long and meaningful relationship
with the code they write.

Don't just write solid code; write happy code.

Related Topics >>