quote:Original post by flangazor I personally hate writing functions that are only called once. In fact, I should have probably reworded my initial statement to say "people shouldn't write functions that are only called once"
That's getting even more dogmatic. If you were in an interview situation would you suggest that as being a good coding convention? What if they responded by saying 'And if it's only called once or twice? Or three times?'
Breaking large functions up into smaller functions is a key starting point into rearranging code, making it flexible, being able to move functions around that really should be on a different class, or higher or lower down an inheritance structure, doing away with duplicated code, having functions with meaningful names so that you need less comments, being able to profile smaller sections etc. etc.
If you've got some spare cash, read Refactoring by Martin Fowler for more info on the above way of looking at and working with code. The link is the cheapest I could find in the UK if you're still in London. Otherwise get it from the library (c:
[edited by - petewood on June 19, 2003 5:47:37 AM]