Re: Migrating a system incrementally. Was: Re: Static vs. Dynamic typing (big advantage or not)---WAS: c.programming: OOP

From: Robert C. Martin (unclebob_at_objectmentor.com)
Date: 07/24/04


Date: Fri, 23 Jul 2004 22:33:57 -0500

On Fri, 23 Jul 2004 09:09:07 -0700, Alan Balmer <albalmer@att.net>
wrote:

>On Thu, 22 Jul 2004 23:59:03 -0500, Robert C. Martin
><unclebob@objectmentor.com> wrote:
>
>>On 22 Jul 2004 01:38:05 -0700, oliver@plohmann.com (Oliver Plohmann)
>>wrote:
>>
>>>Once you have your test suits you can change things must quicker with
>>>static typing. You just don't make that many errors to begin with that
>>>your test cases would have to catch.
>>
>>I've never seen anyone make that argument before. It's certainly
>>quite different from my own experience. Perhaps it's just different
>>strokes for different folks.
>
>You must remember that we non-xtreme programmers do not deliberately
>produce lousy code just for the pleasure of Refactoring it. We still
>believe in the old-fashioned notion of knowing what it is you're
>trying to do and getting it right the first time.

Good for you. How many times have you gotten it right the first time.
Compiled and executed perfectly the very first time? No errors, no
warnings, no failures.

I may be a really lousy programmer, but in my 30+ years as a
professional programmer I have yet to get it right the first time.
(Though I did get it right the second time once about 25 years ago for
a small assembly language program that I wrote.)

>>>Secondly, your test cases are
>>>never complete. The compiler will also catch things your test cases
>>>don't cover.
>>
>>True. But IME the cost of the static typing outweighs that
>>difference.
>
>Cost? Do you mean the extra 10 milliseconds of build time, or lack of
>design flexibility, or what?

Build time is *significantly* longer. In C++ it is a function of the
square of the number of lines of code. In Java it's something greater
than linear (probably n log n, but I haven't worked it out). In a
dynamically typed language build time is zero.

Design flexibility is strongly constrained in a statically typed
system. Especially one that does not allow multiple inheritance.
Trying to get the types just right take a considerable amount of time
and effort.

(Remember, I am a Java, C#, and C++ programmer by trade. Those are my
languages of choice. I know something about the costs of static
typing.)

-----
Robert C. Martin (Uncle Bob)
Object Mentor Inc.
unclebob @ objectmentor . com
800-338-6716

"The aim of science is not to open the door to infinite wisdom,
 but to set a limit to infinite error."
    -- Bertolt Brecht, Life of Galileo



Relevant Pages

  • Re: Migrating a system incrementally. Was: Re: Static vs. Dynamic typing (big advantage or not)---W
    ... How many times have you gotten it right the first time. ... professional programmer I have yet to get it right the first time. ... But IME the cost of the static typing outweighs that ... dynamically typed language build time is zero. ...
    (comp.object)
  • Re: Exception Handling...
    ... System time is cheaper than programmer time. ... Theres a difference between best case cost or trivial cost, ... I don't want the language doing it for me, or worse still, wasting ... to add behaviour, it's actually to subtract behaviour: ...
    (comp.lang.pascal.delphi.misc)
  • Re: [Lit.] Buffer overruns
    ... regardless of the language chosen. ... What is the cost of implementing a solution that meets the design ... of two, for the average programmer, is a big deal. ... there is a spectrum of (security benefit) vs., ...
    (sci.crypt)
  • Re: Python or PHP?
    ... > every language here and there more ways to do something. ... The best the programmer can do, as you imply, is to ... parse out into proper perl expressions. ... > lists, dictionaries, etc. etc. ...
    (comp.lang.python)
  • Re: Python or PHP?
    ... >> every language here and there more ways to do something. ... The best the programmer can do, as you imply, is to ... I am curious of a list of extraneous methods in Perl (more about the ... I just had a glance on Python, ...
    (comp.lang.python)