Monday, January 28, 2008

Polyglot Programming Parallels Perched Precariously per Patron Participation

I just finished delivering my Software "Engineering" & Polyglot Programming keynote at the 2nd installment of CodeMash, and I got lots of great feedback from it. And it was the feedback that's useful, not the welcome but ultimately less than useful "I really loved your keynote". As I had hoped, some of the attendees took my remarks as a starting point and expanded upon what I said.

One good example of this is from Nick Watts. He sent me a long email, following up with blogged thoughts here and here. To summarize Nick's points, he noticed that many great writers will use phrases from other languages when the native language just won't do. I discussed this in a blog entry about Ruby syntax, but in this context it is more about polyglot programming than about Ruby. Nick notices it in Tolstoy's War and Peace, where the English translation leaves the French phrases alone. The first time I really took notice of the pervasive use of foreign phrases was in Nabakov's Lolita (which isn't translated, it was written in English), where the author uses so many French phrases that it distracted me at first. But then, I started looking up what the phrases meant, and it turns out that Nabakov was able to utilize phrases that just dripped with connotation with well placed French colloquialisms. "Joy of Life" as a translation for "Joie de Vivre" is a poor, hopelessly literal translation, missing all the rich connotations of that phrase. Another recent example popped up in the excellent book I'm reading called The Rest is Noise: Listening to the Twentieth Century by Alex Ross. He uses the phrase "Fin de si├Ęcle" over and over, but it carries much deeper meaning than just "end of the century", because it captures with it the connotations of what was happening then.

When I was an inexperienced reader, foreign phrases like this annoyed me, because I had to go look them up. Isn't English good enough? But as I've become a more experienced reader, I understand that some languages have phrases (colloquialisms) that are simply more expressive in very compact form. Translated to software, we are so accustomed now to writing in our "One True Language" that seeing other mixed in languages is off-putting. But, as we become more versed in polyglot programming, we'll see more opportunities to leverage appropriate colloquialisms in other programming languages to add to the expressiveness of our solutions without having to spell everything out in excruciating detail.

Thanks to Nick for not just listening to what I had to say, but listening to what I had to say. There is no greater reward for a speaker.

Tuesday, January 22, 2008

Talking Heads from CodeMash

I got ambushed by someone with a video camera again, but it wasn't too painful. Just after my keynote at CodeMash, someone from Enerjy approached me and asked if he could film me chatting about some of the themes I suggested in my keynote. Well, it isn't hard to get me to talk about software, so he filmed some short segments. He also nabbed some of the other speakers and asked them similar questions, putting them together in themed video shorts. The first one is here: myself and my friend Andy Glover talking about the perpetual argument of art vs. science in programming.

Thursday, January 17, 2008

Language Abstraction Layers

Those who follow what I write and speak about realize that I return to several themes consistently: polyglot programming, domain specific languages, and dynamic languages. At some point, I thought I should tie those things together. And then someone did it for me better than I could have myself. My fellow ThoughtWorker, Ola Bini, writes brilliantly about the intersection of these topics in this blog post.

Ola is probably best known recently as one of the committers on the JRuby project. He's also a bigger language geek than me (no small feat). I think he correctly identifies the future abstraction stack in software: more strongly typed "verifiable" languages on the bottom (ironically implemented in looser typed languages like C for historical reasons), dynamic languages on top for getting real work done, and DSLs for abstractions on top of those to get us closer to the problem domain.

Thursday, January 10, 2008

The Craptaculous Web Framework

At No Fluff, Just Stuff, Sunday after lunch is reserved for the speaker's panel and poll. Jay polls the audience to find out what version of Java everyone is using, which Ajax libraries, IDEs, and that sort of stuff. One of the questions he always asks is "Which web frameworks are people using"? Generally, Struts still rules the numbers (although, recently, he's been asking how many people would use Struts on a new project and the numbers plummet). He rattles off the litany of web frameworks (there are dozens in the Java world, after all). And, on the panels I'm on, I pipe in by asking people how many are using their own, home grown "Craptaculous" framework. Interestingly enough, there are always hands. And the home grown Craptaculous framework generally beats out some well known rivals, like JSF (thank heavens) and Tapestry (what a shame).

This really shows the confusion in the Java world around about web frameworks. The only clear consensus is around Struts, and only because there are lots legacy projects that started with it. I put this down to the The Paradox of Choice, which Scott Davis references in his keynote No, I Won't Tell you Which Web Framework to Use (or, the Truth, with Jokes). Yes, there is an entire hour-long keynote about this topic. The Paradox of Choice shows that people's decision making capacity shuts down when presented with too many choices. The classic example from the book is the store selling jam. A little boutique store started presenting jam samples to entice customers. When they put out 3 different flavors, customers sampled them and the sales of jam soared. More must be better, right? So they put out 10 difference flavors...and the sales plummeted. When presented with too many choices, people's decision making ability shuts down.

Which I think it at play now in the Java web space. Scott's keynote is a direct result of this. Inevitably, at No Fluff, Just Stuff shows, the question comes up on the expert panel: "Which web framework should I use?" If there were only 3, you could reasonable go compare them. When the number reaches 10 or 20, there is no time to go sample each one. Thus, paralysis sets in and you end up using Struts (again), or creating another version of your home-grown Craptaculous framework.

For better or worse, other markets don't suffer from this. In the .NET world, there is only one: ASP.NET. But that is a different kind of market. Despite the efforts by many in the ALT.NET space, open source isn't nearly as prevalent in the .NET world as in others (I can't tell you how many clients I've talked to that created their own logging framework for .NET -- it just never occurred to them that this problem has already been solved over and over). In the Ruby world, there is really only Ruby on Rails (although there are others, they have a very small following compared to Rails). Same in the Python world: there are several frameworks, but as an outsider looking in, it seems that Django has all the buzz now.

Which suggests a clear new front runner in the Java world: Grails. Because it is based on Groovy, not Java, the perception is that it is the only game in town. That will help drive the adaptation of Groovy like wildfire. In fact, I think that Grails is the engine driving the interest in Groovy. New languages are cool and all, but until you have something to do with them, they don't catch on (look at what happened with Java when servlets came along).

Of course, I would be remiss not to mention that Rails now runs on the JVM via JRuby. However, I think this is perceived by many in the Java world as a bigger transition than Groovy and Grails. Ruby is a completely different language, with different idioms. To hard-core Java-ists, Groovy is practically Java, with most of the stinky parts removed. Once Grails becomes 1.0 and beyond, it may be salvation from the home-grown Craptaculous framework that Java developers are still using.

Wednesday, January 02, 2008

C# MVP & Polyglot Programmer

I got the news today that I've been voted Microsoft C# MVP for the second year in a row. This may come as a surprise to people who only know me through my speaking at Java conferences, or think of me as a Ruby militant. But at heart, I'm a language geek. I love computer languages (it was after all my specialization in college) and I try not to get too religious about technology (to varying degrees of success because I also tend to get excited about technology). At my core, though, I'm a language switch hitter. I think it's important in this day and age of polyglot programming to understand a variety of different languages, as they are the design tools we use to craft software. Just like regular engineers must understand the physical properties of different materials, we should understand the capabilities, strengths, and weaknesses of different languages. And when to apply them.

Being a consultant affords me lots of opportunities to use different languages for different projects. The next project I move too is likely going to be a C# project. My last few have been (in order) Java, Ruby on Rails x 3, .NET x 2, and Java. I firmly believe that you should be versed in lots of languages because knowing multiple languages also exposes you to different idioms. I think that the classic K&R book ( The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie) was as much about the idioms of C programming as the language itself. And, of course, the Pragmatic Programmer admonishes developers to learn a new language every year. Dave Thomas has been very publicly learning Erlang over the last year or so (and taking lots of people with him). So, since it's new year's resolution time, what new language are you going to learn this year?