Static/Dynamic Typing and Productivity

7 AM May 15, 2003

Dave pointed me to his writings on the topic of Static vs. Dynamic. In true Internet debating style, let me just address one of his points for the time being:

Python, PERL, and other scripting languages have features outside of weak typing that make them easy to program in. PERL‘s list manipulation, terse syntax, and regular expression handling are a huge part of the appeal. If you add strong typing to PERL, you really don’t lose a whole lot.

I agree that typing is not responsible for the whole productivity increase1 of Perl and Python over Java. But it sure is a lot of it.

I remember when I tried to explain to a bunch of C++ programmers that the main benefit of Java garbage collection is the reduction in memory management logic throughout your program. Initially, the C++ programmers just couldn’t see how much of their design and code dealt with keeping track of who owned which memory and making sure it was released. It was like explaining water to fish.

Similarly, much of a Java program is due to the need to satisfy the compiler. Not only do individual lines of code get longer due to the need to (keyboard) type more2, but the design and existence of whole blocks of code and even entire classes is dictated by the need to satisfy static type checking.

A simple example is anonymous inner classes. A powerful concept, but unfortunately it requires four lines of boilerplate to wrap a single line of code.

As far as what you do differently in a dynamically typed language in order to ensure that you have a correct program… I’m sure that there’s a blog entry there.

1 And when I say productivity increase, I am comparing apples with apples: effort required to get programs running with similar and acceptable levels of defects.

2 I wrote about that here.

By alang | # | Comments (0)
(Posted to Software Development)

Comments

Add Comment




(Not displayed)






(Leave blank line between paragraphs. URLs converted to links. HTML stripped. Indented source code will be formatted with <pre> tags.)




© 2003-2006 Alan Green