Don't let the language choose you

I have a mixture of feelings reading all the recent drama when James mentioned scripting languages. On one hand I love to see people who are passionate about their profession. On the other hand, some of the debate has been rather shrill.

The world has moved on 10 years since the Java language was shiny and new, when its c-like syntax was so reassuring to the generation of developers who have now learned it. I did feel like the exception at the time, because my first language was Smalltalk (aside from some tinkering in c trying to find rational points on elliptic curves which we won't go into). For me, now as it did then, the language debate mostly reduces to ongoing choices we each make about our development style and how it applies to what we're trying to do. And choices we should feel free to make differently in the future.

Am I organized or organic ?

One axis along which languages are compared is whether they are statically typed like Java or C#, where you have to declare as you use a variable what its type is, or dynamically typed, like Python or Smalltalk, where you can defer that decision till later. If you answer yes to one or more of the following...
  • You spell check all your emails
  • Your books at home are arranged in alphabetical order. repeat with CDs. Spices ??
  • You look at a movie trailer and think, "I have that font."
  • You have moments of truth to do with parsley and the teeth of people you don't know well
... then you're definately inclined to be a static typer.

Statically typed languages require you to plan ahead, declare your design intention, and take an organized approach, or if you do not fold your metaphorical napkin after eating, the compiler will catch you. With dynamically typed languages you can be much more experimental, forging ahead altering API protocols as you go, like a Jackson Pollack, living closer to the edge and in the world of runtime exceptions.

Do I already have a design in mind ?

Which is why many people love dynamically typed languages for prototyping applications, where an organic approach, and ad hoc design, can lead to quicker results. And that's not the only situation. Web programmers live on this edge all the time where both the application lifecycle is quick and the application lifetime is short. They need to rip and replace quickly, using languages like PHP.

The 'design as you go' style of programming is much a more weighty task if you're using a statically typed language (which is why I \*heart\* the refactoring tool in NetBeans). But when it comes to working in larger teams, where you're using APIs being evolved by other team members, that statically typed languages come into their own, despite some people's personal taste. Larger scale programming jobs require team members to define what interfaces they are using, and publishing, before they use them, usually meaning the they save development time and maintenance effort. The forethought required by static languages lends itself to the planning and communication required by larger teams of developers working on a larger scale system.

Is the language the only thing you choose ?

I think this is one of the reasons I find it hard to get really worked up in this debate, because the answer to this question is often no. If you choose a language, do you have access to enough supporting libraries or platform APIs ? Can you choose the tools you wanted ? Did your favorite vendor or community cabal support this ? Can you explain it to your IT Director without blushing ?

In .NET your passion for Visual Basic could lead to untoward consequences. Like limiting your potential to choose platform libraries, OS and hardware. Or even leading to a dead end !

Freedom to choose the language you like

For the Java SE platform, we are firmly on course to keep you flying the flag for some of your favorite languages, particularly dynamic ones. In Java SE 6 'Mustang', I'd already mentioned that you can run JavaScript on the JDK out of the box, and made supporting other scripting languages pluggable.

This is a great start, but there's more coming: what with Java being statically typed and all, writing interpreters for dynamic languages is a tricky business, so Gilad started a new JSR to add a new bytecode, and maybe hotswapping, especially for this purpose, which we hope will result in more and better language engines for the Java platform.

(I'll have a related surprise of my own soon for you - stay tuned !)

So you see for Java SE, we're making it so you choose the language, not the language choose you.

<script type="text/javascript" language="javascript"> var sc_project=1447348; var sc_invisible=1; var sc_partition=13; var sc_security="e70e42a5"; </script> <script type="text/javascript" language="javascript" src=""></script>

I know you didn't imply that if the bullet points don't apply to you you are statically challenged but there is this assumption somehow, maybe even a tiny bit of ridicule?

Anyway, I don't do any of those things and I'm defenitely a static typer, in fact I wish that some of the scripting languages I have and sometimes still use were statically typed.

The speed in development has almost nothing to do with being statically typed, heck I have seen lots of examples where people used hungarian notation in scripting languages (of course forgetting to change the name from sBookId to dtBookId when they decided to switch from a string-based date to some kind of special object).

And with smart conversions you could still assign a string to a int or a date or whatever as long as the conversion can be done.

The speed is in the fact that you can just code as you go, no compiling necessary, no need to wait, just fire up your editor and go, not in the fact that you don't need to type maybe a few characters more to define the type of a variable or that you don't know beforehand what type you want it to be.

In the end for me personally I want the compiler or parser to tell me as much as possible when I'm doing something stupid and static typing helps with that.

Posted by Tako Schotanus on March 30, 2006 at 05:22 PM PST #

Post a Comment:
Comments are closed for this entry.



« July 2016