From: Anders Bengtsson Date: 2001-04-17T22:29:28+09:00 Subject: [ruby-talk:13751] Re: methods and types --- Dave Thomas wrote: > Second, I use Ruby's type tolerance to advantage > during testing. > Perhaps I have a routine that's going to add some > data to a file. I > know it uses '<<' to do the append, so during > testing I can pass in an > empty string, and then check the value in that > string when the routine > exits. This may be an instance of some design pattern about strings. When programming in Ruby i often start out with string representations of data, and only later change it to use a more specific class. An example could be an adress book application. In Java I would probably have a Name class from the start, that knows about family names and given names, and having a Person class with a field of type Name. In Ruby I would use a String for the name, up to the moment that I needed to operate on parts of the name, when I would simply switch to using Name instances, without having to modify Person. /Anders ===== __________________________________________________ Anders Bengtsson ndrsbngtssn@yahoo.se Stockholm, Sweden _____________________________________________________ Do You Yahoo!? Ditt_namn@yahoo.se - skaffa en gratis mailadress p� http://mail.yahoo.se