From: Roy Sutton Date: 2006-05-12T12:49:47+09:00 Subject: Re: A major ruby annoyance! Eric Hodel wrote: > On May 7, 2006, at 7:56 PM, Roy Sutton wrote: > >> Jim Freeze wrote: >>> Try unit testing for a while and you will see. After doing >>> 1) write code >>> 2) write test >>> 3) run test and see it succeed >>> >> I'm not sure why everyone automatically assumed he did not use unit >> testing. Unit testing certainly can point out there -is- an error. >> The fix he proposes for his problem (typoing variable names) tells >> him -where- the problem is. Unit tests can tell you generally where >> you problem is but it still takes the debugging work to step in and >> find out what -caused- the problem. I think people are doing Talha a >> disservice by assuming that if he just tested better his problems >> would go away. > > My unit tests typically tell me which line my errors are on. You > probably haven't written enough tests for your code or aren't writing > small enough chunks of code. > > The biggest change writing tests has done for my coding is to give me > smaller more descriptive methods rather than large methods that do too > much. A method that is more than 10 lines long is probably wrong. A > method that is more than 25 is most definitely wrong. > Just to clarify: I was playing devils advocate for Talha. I do write unit tests and have for many years. I don't typo variable names (often). It's a non-issue for me. I was merely trying to re-express his idea for him. Roy