in reply to Re (tilly) 1: When do you function?
in thread When do you function?
When it comes to breaking functions up, if I have a function which is trying to do several different things, it is usually time to break it up. Likewise, a function which is more than a couple of screens long is about due for a break up. Although the screens one is very relative... Especially when I'm writing CGI scripts which are generating forms, they can get rather lengthy.
Over the last couple of weeks I've been writing a interface for managing Spong - using Perl OO. In an object, if I realise that I need to use some code again (for example: sucking details out of the database about a host), it get's broken out to a new function in the object.
So, there's some of my approaches. Of course, if I sat down and did some decent design before hand I'd only need to use the first one - wishful programming - as the functions would already be broken up logically.
Sigh...
Updated: Right, that link to Spong now works as it should. My bad. (Thanks a for pointing it out!)
|
---|
Replies are listed 'Best First'. | |
---|---|
(bbq) Re: Re: Re (tilly) 1: When do you function?
by BBQ (Curate) on Dec 28, 2000 at 08:25 UTC |