The Artima Developer Community
Sponsored Link

Weblogs Forum
Programming with "Duh" Typing

370 replies on 371 pages. Most recent reply: Aug 8, 2007 9:54 AM by James Watson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 370 replies on 371 pages [ « | 1 ... 204 205 206 207 208 209 210 211 212 ... 371  | » ]
Erik Engbrecht

Posts: 210
Nickname: eengbrec
Registered: Apr, 2006

Static Type Checks are not Tests Posted: Jul 19, 2007 6:55 AM
Reply to this message Reply
Advertisement
> The testing burden in dynamically typed languages is not
> greater than the testing burden of statically typed
> languages, provided that you do functional testing for all
> your requirements. Actually, the testing burden is equal
> in both cases.

I've thought about it, and I've decided that static type checks are not tests. Tests are dependent on codepath. Each test excerises a different codepath (well, more-or-less, some may validate that several different inputs have the same codepath). While static type checking is completely independent of codepath.

More generally, tests are purely empirical, while static type checks are purely deductive.

The point of my comments is that static type checking immediately detects a class of errors that I commonly see in my own code that are very difficult, or even impossible, to detect via testing except by chance.

Unit tests are not enough, because often times the place where the error is introduced (e.g., a member variable is set to a tuple instead of an integer) is often distant, both within the code and within execution of the program, from where the error causes failure (when arithmetic operations are attempted on the tuple). Only integrated testing can detect these errors, and even then a huge set of tests is required. Unless, of course, you specify the types of the member variables on the object and validate them at runtime or check all of them in your tests. In which case you've lost both the time savings and flexibility gain of dynamic typing.

Flat View: This topic has 370 replies on 371 pages [ « | 204  205  206  207  208  209  210  211  212 | » ]
Topic: Programming with "Duh" Typing Previous Topic   Next Topic Topic: Python 3000 Plea for Help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use