From: Robert Dober Date: 2010-04-17T20:10:55+09:00 Subject: Re: Is this good OOP structuring? On Sat, Apr 17, 2010 at 10:10 AM, Derek Cannon wrote: >> And are this many methods acceptable for parsing the HTML or is it >> better if I merge them to make one, clean method? > > I guess I'm ultimately asking here: What should be the criteria for > creating something in a new method? > > Because in this case, I could really just combine count_rows, get_row, > collect_courses, and get_courses... They're not being used for any other > purpose but to ultimately serve get_courses. > Given that certain people (YHS included) consider methods of a length of more than ~10 lines very bad[1] you will re-factor your "one clean method". Given that most of these folks consider long classes (and/or source files) a problem too (for me 300 lines is a pain, I prefer 100) you will get lots of modules to be mixed in. Sometimes I find that this kind of decomposition is a joy and leads to a very modular and readable design, sometimes, I have to admit, code fragmentation becomes a pain too[2]. I guess there is no answer for "ultimately asked questions" (forgive the pun please). HTH R. [1] except the long case statement, which I try to avoid for that very reason ;) [2] but I am a very bad large systems engineer -- The best way to predict the future is to invent it. -- Alan Kay