From: HarryO Date: 2002-01-14T07:48:20+09:00 Subject: Re: Small Methods - a ramble On Mon, 14 Jan 2002 09:03:18 +1100, Ron Jeffries wrote: > > Now most of us who read larger methods are used to doing the reverse. We > look at a big blob of code and figure out little chunks of it. Then > maybe we comment the code or make a note or just leave the figuring out > to the next person. > > Tiny methods -- when you get used to them -- are IME /much/ easier to > write and to work with. I certainly dislike reading large pieces of code. However, the issue I have with this kind of approach, of having hundreds of one or two methods, is that you can't get an overall feel for what is going on easily. You spend all your time trying to find all those methods, as you've suggested. Even with an easy way of finding them, such as some special purpose browser ... by the way, with vi/vim you should be able to use rtags for this, although I've not tried it myself ... I think the problem is that by the time you've jumped around the source half a dozen times, you've forgotten what it was that you were interested in understanding in the first place. Also, it feels like there's a lot of overhead in terms of typing all those method headers. That's not a big issue to me, but if I can avoid needless typing, I'd prefer to. Basically, I think what I'm saying is that I tend to split things up when I think something is sufficiently complex to be a separate routine and leave coherent pieces of code as a single entity. Of course, I'm sure this is a personal preference ... just like using Ruby versus using some other language.