From: wsdng@... (=?ISO-8859-1?Q?Sascha_D=F6rdelmann?=) Date: 2003-07-17T06:52:08+09:00 Subject: Re: How to reduce Ruby runtime error? Xiangrong Fang wrote: > I repeat: Thanks for all the suggestion regarding unit test and > exceptions. Acutally I have already used if/then, or rescue to catch > these runtimes. What I am complaining is that if I have to always do > this in ruby programming, I might be losing all the productivity I > gained from the excellent language. You won't lose your productivity. The topic has been broadly discussed in comp.lang.*. Do a search in groups.google.com on "Why dynamic typing" and "Newbie: argument checking in Smalltalk" http://groups.google.com/groups?q=Why+dynamic+typing http://groups.google.com/groups?q=Newbie+argument+checking+Smalltalk My own opinion is, that your own suggestion about nils behaving like various other objects won't lead to a robust program. (Maybe I still don't get what you meant by robust? ;-) A robust program won't ignore errors. It will detect them and behave in a deterministic way. Unit tests are the best way towards robust programs I know of. The second best is to use some assertion concept based on exceptions. Start with some basic exception handling and focus on error detection instead of error handling. After reducing the total amount of errors you will easily find the places where error handling makes sense and where it does not. Cheers Sascha