Interview at Lang.NEXT

Nick Sabalausky via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Jun 4 22:59:37 PDT 2014


On 6/4/2014 3:43 PM, bearophile wrote:
> Nick Sabalausky:
>
>> In my experience, using heavy dynamic typing throughout a program
>> creates far more work (mainly debugging) than it avoids. Even in tiny
>> ~100 line programs, I've spent large amounts of time tracking down
>> bugs a sane compiler would have immediately pointed out with a
>> comparatively negligible amount of my effort spent on typing.
>
> I think often this happens because you are trying to write Python/Ruby
> code like you are using C++/Java, you assume the compiler will catch
> certain kinds of bugs. If you write Python with the kind of coding
> Python requires, taking more care of the things the Python interpreter
> is not able to spot for you, you will use much less time to debug Python
> code, and the overall coding time will be quite low. In Python you write
> 2-3 lines of tests every 1 line of code, and you test every functions
> for the corner cases you can think of. You don't write more than few 3-6
> lines of code without testing them immediately. So for certain aspects
> you need more discipline to write Python, while for other things it
> needs less. For small and medium programs this leads to sufficiently
> correct Python code :-)
>

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. ;)



More information about the Digitalmars-d-announce mailing list