The power of dynamic languages

April 11, 2007

From time to time, people talk about how dynamic languages aren’t suitable for “real” problems as they are quite a bit slower than static, compiled languages. However, I believe that the combination of dynamic languages’ expressiveness and speed more than make up for the lack of pure speed when compare to static languages. And guess what? Dynamic languages aren’t as slow as you think.

I ran across a perfect example today while reading the ruby mailing list. This post describes the implementation of a spelling correcter (much like the one wordpress is using now as a type this blog). Essentially, this application is given a word and then attempts to verify the correctness of it’s spelling. If the word is spelled incorrectly, it gives back suggestions for the word the user was trying to type. This type of technology is used by Google, among others. This problem seems to be quite daunting and, if one would attempt to solve it, it seems like the use of a static language for pure speed would be needed here. The truth is that this is not the case. Some folks who are much more clever than I am were able to write a 21 line Python script and a similarly sized Ruby script to accomplish this task. And they are fast (the Python script was able to process 10 lines per second, and the darn thing is not optimized at all).

Reading these solutions, I was struck with how completely expressive these languages truly are. Take a look at the post and I’m sure you’ll see what I mean. Reading solutions like this – programmed by obviously brilliant people in these two languages – lead me to believe that dynamic OO languages are the wave of the future.


2 Responses to “The power of dynamic languages”

  1. JoeB Says: what do you think about this?

  2. drewolson Says:

    Seems interesting, but for the work I’ve been doing it’s not quite necessary.

    I was hung up on the whole “visual debugger” thing when moving from Java to dynamic languages like ruby and python, but now I’ve learned to rely on the interactive prompts most of these languages supply.

    When writing my rails code, I use a combination of irb (ruby’s interactive prompt for checking my ruby code I’m unsure of) and the super-awesome-amazing ruby script/console from the base of your rails directory. This boots up an irb session but this session is within your rails project. This means you can manipulate your rails models, view your database and check how information is being passed.

    Last but not least, don’t forget the logs.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: