Why dynamic languages are not cool

Some people love dynamic languages. I don’t. This last week, I found one more reason for it. I might be a bit biased because I love Scala, but lets go for it.

A project I started maintaining a few weeks ago is written in python. I don’t know much python yet, so there is this fact in and by itself. And I must say I’m liking the language. Now, the fact that it is dynamic has already bitten me at least twice.

In one of those, I was trying to understand why a test I just wrote was not working. It was as if one line was being simply ignored… Well, looks like I discovered by accident that I can call methods that doesn’t exist, at least on some objects or classes. I had a misspelled method name. As soon as that was fixed, everything worked fine. Half an hour lost with a problem that the compiler / interpreter should really warn me about.

The other case was a property in an object that simply disappeared. At a certain point in a function, it was there. A few lines later, in the SAME function, it was not anymore. At least this time it was simple to find the problem: a reassignment was being made, which was changing the type of the object.

Again: changing the type of the object. With an assignment. Yes, from a static language lover, this just feels absurd. There is no way this was going to happen in a statically typed language.

Lets end this rant on a positive note. I am liking python. Still, I would like it much more if it was statically typed.

By the way, we are going to have a new scaladores meeting in Sao Paulo on Feb. 23th. If you are in the region by then, please stop by. More information (portuguese) here.

Advertisement
This entry was posted in scala and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to Why dynamic languages are not cool

  1. Pedro says:

    Hey Paulo,

    >Again: changing the type of the object. With an assignment. Yes, from a static language lover, this just feels absurd. There is no way this was going to happen in a statically typed language.

    That is the definition of dynamic typing. Assigning different types to the same variable during runtime. It’s not a disavantage per se, it’s a different design.

    However, you’re confused about scala typing. Scala is statically typed, the only particular aspect is that the type is inferred by the compiler.

    • Well… I really like the compiler helping me like…. a compiler! 🙂

      Now, what do you mean about I’m confused about scala typing? I’m not talking about scala in this post. This post is basically a rant based on experience maintaining a python project.

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s