"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Personally, I like the 40,000 foot view of things, and I like seeing the 40,000 foot view of things when I'm working on someone else's code. So, I like to see the main logic first. Subroutines, to me, are abbreviations, or replacements. They say "I'm not really an operation, but a link to a series of operations." They're shortcuts, abbreviations, macros, etc. (I'm going to get killed for that statement.)
So, I've got my actual logic flow right there, for everyone to see. It's got a bunch of these 'links' to groups of operations. If I want to see a subroutine definition being used in the top level, I don't want to go far. So, all the top-level subroutines are first, in order of invocation. Then, the next level, etc. At some point, I just start chucking things into modules. That's just my thought. I understand demerphq's view on things, wanting to remove unintended side-effects. But, in my mind, that's reverting to the shotgun we all want to use. If he feels he needs the shotgun, that's fine. I personally feel that I know what each and every one of my variables do, and where its scope is, so I don't need the shotgun. I so rarely declare file-scoped lexicals that, when I do, it's for the express purpose of creating a file-scoped global. *gasps from the audience* Globals, just like "goto LABEL", have their purpose. But, that's another node. ------ Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement. In reply to Re: where do you put your subs
by dragonchild
|
|