April 19, 2008
@ 07:20 AM

Last night at the opening of #altdotnet seattle, we had a fishbowl about polyglot programming. I felt several times I wanted to run up and grab a chair but...well...when Martin Fowler, Scott Hanselman, Scott Bellware, Ted Neward and other "celebrity programmers" are all jockeying for the one open chair, what I want to say seems a little less important, relatively.

Not so here on my blog, the desert of the real!

So I have been doing polyglot programming for a while: first basic+assembly (atari 800, apple //), then clipper + c, vb + c++, javascript+c++ (MFC app with embedded web browser control), perl + anything (perl's a slut), vb classic + javascript + c++, c#+javascript, vb.net + javascript...oh, and SQL with all those.

One combination notably missing is c#+vb. Why? There is 99.9% overlap between what I would do in c# and vb. For the vast majority of .net applications in the world, it's either in c# or it's in vb. There are a very few edge cases where it makes sense to have both c# and vb in the same application (using vb for office interop, where methods have craploads of optional parameters comes to mind.) So there is basically no/little value mixing c# and vb. It's like mixing sugar with equal. Just pick one, use it, and be happy.

One combination that's in there several times is <<something>> + javascript. Why? Javascript+DHTML is for a totally different purpose than the other languages. It's specially designed for working with browsers. When I am in browserland, I like to talk browser-ese. I find I have to use fewer words to accurately communicate what I want to say.

Being a polyglot is a big investment. You need to get familiar with the languages. You need to keep up on them and use them, lest they atrophy. Some people don't want to do that. In the web programming space, there are lots and lots of tools that let you use one language and generate another. Some of the helpers in monorail come to mind. Most of ASP.NET, and especially, all of asp.net ajax comes to mind. Commercial tools like Iron Speed definately come to mind. These tools and libraries are like machine translation. whazattchickendrive

I really, really want to know what this web page about some funky USB thing that looks like a chicken foot says. Problem is, it's in japanese. No problem, just use translate.live.com or translate.google.com. This will help me kind of understand what the idea is, but it's no where near as informative as the source page, provided you can understand and read Japanese.

I think a lot of tools that hide/generate/translate from a high level language to javascript/html are like machine translation. It's best if you can just learn the language where you are working - javascript for the web, for example - and tools that translate for you are a cheap substitute.

When deciding to watch a Jackie Chan movie, here in the states, I can chose to watch it in dubbed english sans subtitles, or in Chinese. Jackie Chan's movies often have lots of little puns and side jokes going on. Most of this gets lost when the translate/dub it. To really get a Jackie Chan movie, you've really got to understand Chinese (not just the language, but the culture too.) The translated version sounds like the javascript that GWT generates looks.

Source code is, number one, a tool for programmers to express ideas. Working in the right language for the domain you are in improves your ability to accurately and succinctly express your intent to other programmer and the computer. Treat source code as generate-only gobbleygook, and that's what you'll get.


 
Categories: