Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: A question about the best way to use subroutines

by MeowChow (Vicar)
on Mar 25, 2001 at 12:30 UTC ( #66990=note: print w/replies, xml ) Need Help??


in reply to A question about the best way to use subroutines

Here's some fairly common heuristics for you. Factor code out into subroutines when:
  • You see sections of code that look nearly identical.
  • You realize that some specific task your code performs is just a particular case of a more general task.
  • You can imagine a scenario in which your code would be copied-and-pasted somewhere else.
  • You can think of your code as performing a "black-box" transaction.
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print
  • Comment on Re: A question about the best way to use subroutines

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://66990]
help
Chatterbox?
holli gotta grab some groceries before dawn. l8ters
[erix]: s/dawn/dusk/
[erix]: (you're welcome :P)
[james28909]: you know, i had a thought a few mnths back. what if this universe were just a puzzle, waiting for life to figure it out!
[james28909]: what if one day we are able to grab the curtain that is "spacetime" and pull it back to reveal <insert imagination here> pulling at levers and ropes xD
[holli]: like dorothy?
[james28909]: see ya later holli
[james28909]: yeah like wizard of oz lol. its just a joke though
[james28909]: i cannot understand how someone cant see that a cloud of gas that evolves into a solar system or galaxies. it just makes sense to me. everythign that has happened, had to have happened for anything on this planet to be.
[james28909]: /gas/gas and debris/

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2017-12-15 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (433 votes). Check out past polls.

    Notices?