The Next Big Language?

Monday, February 12th, 2007

Steve Yegge tantalizes us with a post on the next big language, but he won’t say what it is. A lot of people think he’s talking about JavaScript, but I’m betting he’s writing about Groovy.
(more…)

My Next Book

Friday, February 9th, 2007

I’ve been agonizing over how to how to announce this. I’ve told a few friends, and I even let the cat slip out of the bag once on Mokka mit Schlag (though I pushed it back in) but I think rather than worrying any further I’m just going to do it. The contract has been signed and my next book will be:
(more…)

Why Hate the for Loop?

Wednesday, February 7th, 2007

There’s one example that comes up sooner or later every time someone starts talking about closures. This time it’s from Bruce Tate on developerWorks:

Listing 1. The simplest possible closure

3.times {puts "Inside the times method."}

Results:
Inside the times method.
Inside the times method.
Inside the times method.

times is a method on the 3 object. It executes the code in the closure three times. {puts "Inside the times method."} is the closure. It’s an anonymous function that’s passed into the times method and prints a static sentence. This code is tighter and simpler than the alternative with a for loop, shown in Listing 2:

Listing 2: Looping without closures

for i in 1..3 
  puts "Inside the times method."
end

Personally I find the latter example simpler, clearer, and easier to understand. For one thing, when I see the word times suffixed to a number like 3 I expect multiplication, not action. But even if times were changed to a more reasonable method name such as do or act, I’d still prefer the for loop. (Perhaps what you really want here is “do 3 times”. That might really be clearer. )
(more…)

Java as Lingua Franca

Monday, February 5th, 2007

When I travel I speak English. When I teach I speak Java, and for the same reason: it lets me be understood.

When I need to teach cross-platform subjects like DOM or data structures to mixed language audiences, I can easily use Java to show examples and everyone can follow them, even if they’re not Java programmers. Everyone reads at least pidgin Java. Only C++ programmers can read C++. Only Ruby programmers can read Ruby. (Still better than Perl though. No one can read Perl, Perl programmers included.)

Of course, if you’re traveling in one area, it’s better to speak the native language if you can. French gets you farther in Lyons than English, but if you’re at an international conference English is your only hope. If you’re at RubyConf, Ruby will get you far. However if you’re at OOPSLA or Software Development, Java is the way to go.

Java is the programmer’s lingua franca.
(more…)

CICE: Not So Nice

Thursday, February 1st, 2007

I’m still trying to wrap my head around closures, so I can decide if they’re a good idea or not; but there is one specific proposal I am willing to shoot down: Concise Instance Creation Expressions by Bob Lee, Doug Lea, and Josh Bloch. In fact, I think they shoot it down themselves pretty effectively without noticing what they’ve done. Here are their examples:
(more…)