From: Henrik Horneber Date: 2004-10-06T02:43:11+09:00 Subject: Re: A ruby course Brian Schr�der wrote: > Hello Group, > > I need more help. > > Gavin Sinclair wrote: > >> >> p51. Good exercise. How about another? >> > > Anybody has an idea for an exercise on extending existing classes. So > far the only thing I have come up with is: > > \exercise{Fibonacci II}{ > Extend \codetype{Integer} with a function fib that calculates the > corresponding fibonacci number.} > > And my creativity is at an all time low. > Hi! what about - extending REXML::Element with a method that strips all unnecessary whitespaces and all children - extending String so you can tell it to remove cpp comments /* remove me */ Of course both tasks could be accomplished without extending those classes. I have no idea in which cases you should write helper methods and when you should extend existing classes... does anybody have some 'heuristics' or best practices? regards, Henrik