As a dynamic language, Ruby is much more flexible and easier than other
language I use, for example, Delphi. However, there is a "intrinsic" problem
in ruby programming -- a typical error I get again and again:
private method `split' called for nil:NilClass
The following statement:
array.pop.split(',')
will generate this error if array is empty. Of course I can use rescue
Exception statement, as a matter of fact, I do use that. Even after 4-5
years, some of my program still generate these kind of error occasionally.
Real-world situation is just too complicated. How do we write robust AND
elegant code, and let our thinking smooth rather than considering exceptions
all the time?
Experts, please tell us, your best practice, facing this "intrinsic" problem
of dynamic languages...
Thanks,
Shannon
_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters!
http://www.msn.co.uk/newsletters