Why does Dynamic Typing really matter?!?

Peter Hansen peter at engcorp.com
Thu Feb 6 14:57:49 CET 2003


Jason Smith wrote:
> 
> I'm doing some research into language constructs, particularly dynamic
> typing.  What I'm looking for are examples in dynamically typed
> languages that clearly illustrate the benefits that dynamic typing
> give to a solution to a problem.  I'm aware that dynamic typing
> provides the following,

Oh, believe me, it provides much more than that!  ;-)

> But what I want need is an solution to a problem that would not be
> possible to replicate in a statically typed language...

Although I wouldn't claim that there is NOT such a thing, I'm also
not sure that the existence of solutions which cannot be replicated
with statically typed languages is at all biggest benefit of a
dynamically typed language.

For me, Python provides as a result of its dynamic typing, much 
higher productivity as I simply don't spend time worrying about 
punching the keys that produce all that static typing information
for the compiler to use to tell me where I need a type case or
something like that.

Python also makes life simpler when I can provide an object which
has the necessary "interface" (in the sense of supporting the
method that will be called on it in the context in which I'm using)
without actually having to be derived from a specific parent class
or interface (i.e. with the necessity of providing all kinds of
methods which aren't needed in the context in question).  

This is extremely useful for automated testing, such as is used in
Extreme Programming so heavily, especially for providing mock
objects to decouple sections of the system during testing.  For
this reason alone, I think dynamically typed languages are often
more productive by a long shot in an XP environment than any
statically typed languages.

-Peter




More information about the Python-list mailing list