Pensieri di un lunatico minore

1 April 2008 Technology

Java: Blazing a trail into the past

InfoWorld has an article about Java’s blazing new speed. I read it when it was posted about a week ago, and stewed on it, and various people have commented on it, but I just find the whole thing absurd in the extreme. The fetishistic obsession with speed is amusing, but misguided. As I’ve said repeatedly in the past, performance is a complex topic, and the speed an application runs is often limited by many things unrelated to the actual performance of the underlying language implementation.

My favorite quote, though is this brilliant little insight:

Scripting languages are ideal for smaller programs but Java is the choice for larger programs, he said. “As your program grows in size, the lack of strong typing basically kills your ability to handle a very large program and so you don’t find the million-line Perl program,” he [Cliff Click] said. One-million-line Java programs are plentiful, Click said. Strong typing refers to the capability of knowing the type of memory objects.

I don’t know about you, dear reader, but the concept of a million-line monolithic program is absurd and laughable. Now, I’m sure 1/2 those lines in a Java program are absorbed in meaningless syntactical stupidity and obsession with XML and the latest nonsense in getting around a brain-dead language, but it’s still an absurd size to build one monolithic system. To me, what this demonstrates is the total inability to demonstrate perspective in understanding when your tool is in the way.

I know of at least one ERP system, implemented in a “scripting language” for a large multi-national corporation. It’s not even close to 1M lines of code, but it is broken into a huge number loosely coupled systems. The company doesn’t care to discuss it publicly as they consider it a strategic advantage to be able to adjust their business at a quick rate.

This entry was posted at 9:40 am on 1 April 2008 and is filed under Technology. You can follow any responses to this entry through the post-specific RSS 2.0 feed.

They are wrong about million-line Perl programs. There’s nothing inherently failing in a late-binding language like Perl in providing the ability to scale. The problem is one of discipline… just because you can build a doghouse from wood doesn’t make you qualified to build a 5-story wood building without training. Similarly, the skills to write a 100-line script with Perl do not directly scale to the million-line program… it requires training and discipline, just as it does for Java or any other language.

I agree that you could build a million line Perl or Python program, but that goes against everything both communities encourage: modularity. In addition, with the semantic density that both languages contain, I would guess that a million line Java program would only be 1/2 or less than that in either language.

Also, writing a million lines in Java just requires using one of the many “code generation” tools that write thousands of lines for you that you’d never have to write in another language. I’m not saying this is static v. dynamic, just simply bad language design for Java.

John Lam once blogged about taking an ecommerce application, written in C#, with 20,000 lines of code, rewriting it in ruby and trimming it to 200 lines of code. The ruby version was 100 times faster than the c# version because he was able to take out the SQL database and load the whole data in an inmemory datastructure and than caching results from expensive algorithms.

Read more about it here
http://www.iunknown.com/2005/10/do-databases-ro.html

As always, picking right algorithms and datastructures can produce solutions which are orders of magnitude faster than some lame implementation running on the fastest Azul system appliances.

You can leave a response, or trackback from your own site.