Type Wars

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
Here's an interesting topic that came up on dynamic vs. static typing and the current pursuits of static typng in functional programming when we have processes like TDD. Here's the article's conclusion:
And so here we are. The pendulum is quickly swinging towards dynamic typing. Programmers are leaving the statically typed languages like C++, Java, and C# in favor of the dynamically typed languages like Ruby and Python. And yet, the new languages that are appearing, languages like go and swift appear to be reasserting static typing? So is the stage for the next battle being set?

How will this all end?

My own prediction is that TDD is the deciding factor. You don't need static type checking if you have 100% unit test coverage. And, as we have repeatedly seen, unit test coverage close to 100% can, and is, being achieved. What's more, the benefits of that achievement are enormous.

Therefore, I predict, that as TDD becomes ever more accepted as a necessary professional discipline, dynamic languages will become the preferred languages. The Smalltalkers will, eventually, win.

So says this old C++ programmer.
http://blog.cleancoder.com/uncle-bob/2016/05/01/TypeWars.html

I find it strange that Uncle Bob's argument seemingly fixated on a this or that choice; because choosing static typed languages and/or functional programming (FP) doesn't implicitly mean you've chosen to avoid TDD. More importantly FP requires that functions clearly define their inputs/outputs i.e. it actively enables TDD.

Dynamic on the other hand, which Uncle Bob champions is arguably far more difficult to test for, especially when we consider that much of its state is all but unknown until runtime.
 
Last edited:

gkm

Expert Member
Joined
May 10, 2005
Messages
1,519
The arguments for using TDD to mitigate all the hassles brought by dynamic typing is for me similar to saying one should be crawling everywhere so that you can be forced to use knee pads and gloves. TDD should bring extra safety, not just get you back to baseline safety.

Dynamic typing is fine for small projects, but the tons of extra tests needed to make it safe for bigger projects is a huge extra burden. These tests tend to fall behind, so deployments start involving a lot of praying. Software deployments are already the main reason for outages for most significant systems, so I do not understand why one would increase that risk and make extra work without having some other significant benefits. And having to write a bunch of brain dead tests to tests for all possible inputs/outputs for every method is not a benefit in my opinion.

I would also rather use a language where the compiler does the lowest level of testing, rather than having to maintain the tests myself. And at the same time get other benefits like better performance etc. So, one sometimes has to wait a couple of seconds for the compiler, but with most IDE's the compiling is done in the background, even that does not happen often.
 

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
The arguments for using TDD to mitigate all the hassles brought by dynamic typing is for me similar to saying one should be crawling everywhere so that you can be forced to use knee pads and gloves. TDD should bring extra safety, not just get you back to baseline safety.

Dynamic typing is fine for small projects, but the tons of extra tests needed to make it safe for bigger projects is a huge extra burden. These tests tend to fall behind, so deployments start involving a lot of praying. Software deployments are already the main reason for outages for most significant systems, so I do not understand why one would increase that risk and make extra work without having some other significant benefits. And having to write a bunch of brain dead tests to tests for all possible inputs/outputs for every method is not a benefit in my opinion.

I would also rather use a language where the compiler does the lowest level of testing, rather than having to maintain the tests myself. And at the same time get other benefits like better performance etc. So, one sometimes has to wait a couple of seconds for the compiler, but with most IDE's the compiling is done in the background, even that does not happen often.
Exactly. You can make a table with just a mallet & chisel, but considering the wide variety of power tools, why would you?

image.jpg

image.jpg
 
Top