The Artima Developer Community
Sponsored Link

Agile Buzz Forum
How common are type errors?

0 replies on 1 page.

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 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
How common are type errors? Posted: Aug 20, 2006 10:28 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: How common are type errors?
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

Hmm - Erik writes that he doesn't like dynamic languages after moving from Python to Ocaml:

This particular error is typical of a whole class of errors that can exist in dynamically typed programs [0] but may never show up until the program is in the hands of a user. Personally, I think programs blowing up like this in the hands of users is unacceptable. Unfortunately, its also extremely common; so common that most regular computer users would have experienced things like this at least once. To me, this is a failure of discipline of software engineering.

Here's his error:

 

try:
      data = my_obj.read (1024)
  except:
      print "Read on '%s' failed" & my_obj.name ()


The error is the ampersand in the exception handler, which didn't hit until the first error. Well, that's why we have testing in general, and unit testing in particular. Personally, I find that specific kind of error rare, but it would be caught immediately with a small test.

What did he do wrong? Well, under what circumstances would you put a data read/entry function into an application and deploy it without testing how it deals with bad data? Seriously - this is not a problem that type checking will solve for you very often - the much more common error I've had in my own code is a correct statement with logic problems - something a compiler won't catch (what do you mean I can't write a file there?).

The problem he talks about is not, in general, one that you can solve with type checks. It's one you can solve with testing. Getting more feedback from the compiler may help him feel better, but it won't actually help much.

Technorati Tags: ,

Read: How common are type errors?

Topic: Telcos gone wild Previous Topic   Next Topic Topic: How to really get noticed

Sponsored Links



Google
  Web Artima.com   

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