On Thu, 05 Jun 2014 09:30:44 +0200
Andrei Alexandrescu via Digitalmars-d-announce
<digitalmars-d-announce@puremagic.com> wrote:

> On 6/5/14, 7:59 AM, Nick Sabalausky wrote:
> > So let me get this straight: There are programmers out there who
> > find the occasional type annotations on some declarations to be
> > significantly more work than following a convention of nearly
> > *quadrupling* the amount of code they have to write? Two to three
> > lines of tests for every one line of real code is considered rapid
> > development, "saving developer time", "just getting things done",
> > etc? And all that's considered a "style" of coding?
> >
> > You're right, I really don't understand that style of coding at
> > all. ;)
> >
> > Don't get me wrong, I am pretty big on unittests, but even still: If
> > people are trying to save developer time by replacing each minor
> > type annotation with several extra unittests (which are less
> > reliable anyway
> > - greater room for human error), then something's gone horribly
> > wrong.
> >
> >  > It's usually quite hard to explain such
> >  > differences in coding stile to people that are used to static
> >  > typing.
> >  >
> >
> > That doesn't surprise me. It's also very difficult to explain
> > 2+2==5 to people who are accustomed to basic arithmetic. ;)
>
> I have to confess this echoes a few similar confusions I have about
> the use and advocacy of dynamically-typed languages. One argument
> I've heard a while back was that static type errors are not
> "proportional response" and that static types only detect the most
> trivial of bugs, so why bother at all. But then the heavy-handed
> approach to unittesting espoused by dynamic languages, of which
> arguably a good part would be automated by a static type system,
> seems to work against that argument.

Indeed. It just makes no sense to claim that using dynamic typing is simpler
and easier when you're then forced to write a bunch of test code just to catch
bugs that the compiler in a statically typed language would have caught for
you anyway.

Though I confess what horrifies me the most about dynamic languages is code
like this

if(cond)
    var = "hello world";
else
    var = 42;

The fact that an if statement could change the type of a variable is just
atrocious IMHO. Maybe I've just spent too much of my time in statically typed
languages, but I just do not understand the draw that dynamically typed
languages have for some people. They seem to think that avoiding a few simple
things that you have to do in your typical statically typed language is
somehow a huge improvement when it causes them so many serious problems that
static languages just don't have.

- Jonathan M Davis

Reply via email to