From: "John W. Long" Date: 2004-06-07T04:08:00+09:00 Subject: Re: How to ducktype a Hash? Sean O'Dell wrote: >One test I can to really solve this problem is to create artificial tags for >Hashes, my objects and any other objects that get created either by me or >someone else as Hashes. That solution will work, but my complaint is that it >feels like such a kludge. My problem is solved though -- I have several >choices now. I just wish Ruby did this already. I am getting bit by little >stupid things that are hard to catch, and my growing project is now starting >to feel REALLY unstable. I never get that feeling with C++, so I guess I >should stop trying to use Ruby for these larger projects. This one though, >it started so nicely and fast...but now, it feels sort of kludgy and I don't >have a feeling of confidence about its ability to either perform properly, or >at least report errors that I consider errors. Since there is no typing >mechanism at all, I can't tell Ruby "hey, anything but a hash-like object >here is an error." > > I have only a small amount of experience with using Ruby on large projects, so maybe some others can chime in here. You said earlier that you were not using unit tests any more because they seemed like too much work, but they did not save any time in the debugging game (forgive me if I have misquoted you). I wonder if what you are finding is that Ruby w/o Unit Tests is much harder to use on large projects than Ruby w/ Unit Tests. Type checking is a form of unit testing (only in most cases it occurs at compile time). Languages without type checking often need another form of testing. Unit tests help automate the process of exercising your code making sure nothing has broken. This gives you a level of confidence that allows you to refactor mercilously. Without unit tests I can understand why you would find Ruby frustrating. I have a tendency to believe that small projects are doable in Ruby without unit tests, but larger projects require some form of automated testing. I'm curious, is this generally true for all dynamic languages? Should unit tests be a requirement for large projects? -- John