From: matz@... (Yukihiro Matsumoto) Date: 2001-08-15T02:07:26+09:00 Subject: [ruby-talk:19710] Re: class methods and optimizing Hi, In message "[ruby-talk:19699] class methods and optimizing" on 01/08/15, Chris Moore writes: |Does anyone know what class methods are as opposed to instance methods? Are |they for optimizing? when would I use them?I have looked at a couple manuals |that tell you how to do them: def classname.method but none seem to explain |the why and when. Some functionality, for example object creation, is NOT belong to specific instance, so that it must be provided by class method (since no instance is there yet). That's why. |And this leads to my second question. In terms of memory usage and speed, is |it better to extend the existing classes (when possible) or to build your |own, or to just make a subclass? Due to method cache, there's no significant performance difference, so feel free to subclass. matz.