Robert Dober
2/11/2009 12:03:00 AM
On Tue, Feb 10, 2009 at 11:21 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:
<snip>
> That's fine unless you want to, say, override the class method in a subclass
Good point, but there is another issue here.
Your project guru comes along and tells you: Nice code, but we should
not use the name Test (for a dumb reason of course).
Now you have to change Test to Check in your source
would you prefer to change it here
class Test
def a # multiply this with n entries
self.class.x
end
def self.a
...
or here
class Test
def a
Test.x
end
def Test.a
end
In other words the second version is not DRY and the worst penalty for
unDRYness is the need to change your code.
Robert
--
It is change, continuing change, inevitable change, that is the
dominant factor in society today. No sensible decision can be made any
longer without taking into account not only the world as it is, but
the world as it will be ... ~ Isaac Asimov