Thursday December 15, 2005
I had a long and fascinating Wednesday with a couple of folks from
Berkeley's new RAD Lab (press,
home). While
their public decoding of the acronym RAD is "Reliable Adaptive
Distributed", they also care deeply about the more common decoding: "Rapid
Application Development". The conversation was all over the map, but a
major thread was about the design tension between scripting
languages and strongly
typed general
purpose languages.
Over the years I've used and created a wide variety of scripting languages, and in general, I'm a big fan of them. When the project that Java came out of first started, I was originally planning to do a scripting language. But a number of forces pushed me away from that.
The biggest was concerns about performance and the inevitability of scale. I can't remember how often I've had experiences where someone has proudly shown me some system they've put together using the scripting-language-du-jour: things like an Adobe Illustrator clone written entirely in PostScript; a satellite groundstation diagnostic system written as TECO macros; a BASIC compiler written as Emacs macros; fourier transform algorithms in PostScript... This list is endless. They always ended with "this is so cool, but I'd like it to be as fast as {C,Assembler,whatever}". People get into scripting to quickly build small quick things, but they often grow far beyond where the initial concept started.
Another was about testing, reliability and maintainability. One of the common properties of scripting languages is brevity. This tends to lead to omitting declarations, weak typing and ignoring errors. Generally a great thing if you're quickly putting something together; not so great if you want checks and balances that crosscheck correctness.
Another is generality. Many scripting languages get a good part of their coolness from being specialized - by having key functionality wired into their hearts. A good example is perl, with it's great regular expressions and hash tables. But this drags in a number of issues, chief among them being: what if you want to do something outside the language's area of specialization? Many modern apps need to do exactly that, so one of two things happen: languages get used for wildly inappropriate things (fourier transforms in PostScript), or a collection of languages get used together (which can make it very hard for any one person to understand them, and interconnections can be a nightmare).
The list of interesting questions is really long, this blog entry could easily be a book (that I'll never have time to write). This hardly scratches the surface. The number of potential PhD thesis topics is huge.
Posted by Obie on December 16, 2005 at 12:44 PM PST #
Posted by Gollum on December 16, 2005 at 02:27 PM PST #
Before you start talking about scripting languages not being performant or not scaling well, you'd better spend a little time doing some research into the topic.
And, of course, you'd better get that spell checker of yours to understand that Perl is not a misspelling of pearl.
Posted by Lori M Olson on December 16, 2005 at 02:39 PM PST #
Posted by Curtis Hibbs on December 16, 2005 at 02:57 PM PST #
I was also minded to reply to Obie's comment, but it turned into something a bit long, so I've put that as a post on my blog too - Java, Scripting, Credentials, Authority, Reputation and Influence...
Posted by Simon Brocklehurst on December 16, 2005 at 04:07 PM PST #
Posted by Anthony Martin on December 16, 2005 at 04:58 PM PST #
Posted by Bob on December 16, 2005 at 07:13 PM PST #
Posted by Berlin Brown on December 16, 2005 at 09:15 PM PST #
I have several years of experience with Java and Perl, and only about six months with Ruby. Still, I have found that dynamic typing, mix-ins, and lambda functions have led to simpler designs, much less code, and more reliability than doing the same thing in Java or C#.
Performance was much more of an issue in the past than it is now. Java, Perl and Ruby are all fast enough in most situations.
Scalability is important, but I don't believe scripting languages have any particular problems just because they are scripting languages. The factors that contribute most to scalability are probably object orientation and testing frameworks, and all three languages have that.
Both Ruby and Perl comes with unit test frameworks as standard, which is very important when building complex applications. With Ruby and Perl, testing is part of the culture.
With Java, despite the popularity of JUnit, and lots of very capable Java programmers that use it, testing is not part of the culture in the same way. Not to forget, EJB has actively discouraged Java programmers from both testing and using loosely coupled designs. I've had to introduce programmers to unit testing, and teach the basics, in most Java projects I've worked on for the past three years.
Another thing that affects scalability is how complex code you have to write to implement a piece of functionality. Recently, I wrote what was supposed to be a simple parser in Java. To get the flexibility I wanted, with pluggable tokenizers and serializers and whatnots, I ended up with no less than 15 interfaces and classes. With Ruby, I can get the same result with one class and two mix-ins. (I can probably do the same thing with Java and Spring, but then the application has to lug Spring and an XML configuration file around.)
If Ruby allows me to reduce the number of artifacts by 80% compared to Java, then odds are that applications written in Ruby scale better. Simpler design, and fewer lines of code, translate into fewer bugs and cheaper maintenance. (I don't expect the difference to be quite as spectacular in all my projects, but I do expect Ruby programs to have simpler designs in the vast majority of cases.)
I have found that most (though not all) of the things I want to do as a programmer are easier with Ruby than with Java. This includes writing some fairly large applications.
Posted by Henrik Mårtensson on December 17, 2005 at 03:26 PM PST #
At the same time I think we can diffuse most of the current attacks by helping other languages be compiled into java byte code. There allread are a lot of languages that do this, such as Jython, Jruby, Groovy, etc. The people involved in those efforts believe that some byte code changes could help them. Perhaps that is all that is needed to make them happy. And if they write to the jvm then in the long term they are more likely to pick up on java, or perhaps we can increase the likelyhood of the next programming revolution happening on our soil.
Somone mentioned how a lot of java server side frameworks use XML files to intialise, which I think open a whole in the strict semantics of java. After all the only thing one knows about these xml files is that there are strings and tags in there. Perhaps if one started writing property files in a more strongly typed language there would be a better fit with java. I'd like to explore what that would look like with RDF/OWL. Since RDF using OWL ontologies is a type system, perhaps we can close the gap again. in these initialisation files one finds in so many frameworks. Compilers or IDE"s could confirm that the intialisation files are consistent with the type system, and so one could have static type checking there too.
Posted by Henry Story on December 19, 2005 at 12:51 AM PST #
Posted by Willem Voogd on December 19, 2005 at 07:17 AM PST #
Posted by Amor on December 19, 2005 at 08:13 AM PST #
Posted by Roger Hayes on December 19, 2005 at 08:48 AM PST #
Posted by Simon Brocklehurst on December 19, 2005 at 08:54 AM PST #
Posted by Henry Story on December 19, 2005 at 10:33 AM PST #
Posted by J Doe on December 19, 2005 at 01:20 PM PST #
Posted by Berin Loritsch on December 20, 2005 at 11:30 AM PST #
Posted by Michael Neel on December 20, 2005 at 12:53 PM PST #
It is often claimed that the benefits of "scripting" languages do not scale, however I am working as part of a team on an enterprise python application with several hundred thousand lines of code and that is not our experience. The number of bugs we have encountered that would have been prevented by a strictly typed language have been miniscule.
Posted by Dave Kirby on December 21, 2005 at 11:49 AM PST #